-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject.JSON
More file actions
1 lines (1 loc) · 19 KB
/
project.JSON
File metadata and controls
1 lines (1 loc) · 19 KB
1
[{"id":"80f41e14.6c3d9","type":"tab","label":"Flow 5","disabled":false,"info":""},{"id":"802e9d5c.18173","type":"debug","z":"80f41e14.6c3d9","name":"","active":true,"console":"false","complete":"payload","x":1809.5833740234375,"y":1999.749900817871,"wires":[]},{"id":"c6d221dd.3e3108","type":"http response","z":"80f41e14.6c3d9","name":"","statusCode":"","headers":{},"x":448.3125,"y":918.4853744506836,"wires":[]},{"id":"68b51155.60943","type":"http in","z":"80f41e14.6c3d9","name":"","url":"/finalapp","method":"get","upload":false,"swaggerDoc":"","x":85.56250762939453,"y":916.2353801727295,"wires":[["1c682653.41cb62","8d3ece3b.866dd8"]]},{"id":"5fc8c968.44af","type":"exec","z":"80f41e14.6c3d9","command":"ffmpeg -f avfoundation -video_size 1280x720 -framerate 30 -i \"0\" -vframes 1 muskan.jpg","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"Take a picture","x":442.0001220703125,"y":1090.4167404174805,"wires":[["f651b238.922f1","244b75a1.02b182"],[],[]]},{"id":"bf08453.0e56a38","type":"websocket in","z":"80f41e14.6c3d9","name":"","server":"110e61a2.4d53fe","client":"","x":77.00003051757812,"y":1088.666618347168,"wires":[["80ece3c7.fc5e3","c64ca440.fd9a68"]]},{"id":"618ba9c3.856448","type":"visual-recognition-v3","z":"80f41e14.6c3d9","name":"IBM Watson - Visual Recognition","vr-service-endpoint":"https://gateway.watsonplatform.net/visual-recognition/api","image-feature":"classifyImage","lang":"en","x":799.400146484375,"y":1316.6668319702148,"wires":[["4baeaafb.700404","488a0f2.c76a0f"]]},{"id":"4baeaafb.700404","type":"debug","z":"80f41e14.6c3d9","name":"","active":false,"console":"false","complete":"result","x":1104.650146484375,"y":1323.0166854858398,"wires":[]},{"id":"97dc4f39.d2165","type":"file in","z":"80f41e14.6c3d9","name":"","filename":"muskan.jpg","format":"","sendError":true,"x":456.400146484375,"y":1316.9291610717773,"wires":[["618ba9c3.856448"]]},{"id":"488a0f2.c76a0f","type":"function","z":"80f41e14.6c3d9","name":"select classification","func":"if (msg.result.images[0].classifiers[0].classes.length!==0) {\n msg.indicator=0;\n msg.classifier = msg.result.images[0].classifiers[0].name\n msg.class=msg.result.images[0].classifiers[0].classes[0].class;\n msg.score=msg.result.images[0].classifiers[0].classes[0].score;\n}\nelse {\n msg.indicator=1;\n}\nreturn msg;\n","outputs":"1","noerr":0,"x":873.70654296875,"y":1400.3542098999023,"wires":[["10cc1c38.1bed7c","84dec7bb.3f2d28","161ae1c2.8c706e"]]},{"id":"10cc1c38.1bed7c","type":"debug","z":"80f41e14.6c3d9","name":"","active":false,"console":"false","complete":"class","x":1163.406494140625,"y":1396.7666244506836,"wires":[]},{"id":"84dec7bb.3f2d28","type":"debug","z":"80f41e14.6c3d9","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"score","x":1174.70654296875,"y":1443.3542098999023,"wires":[]},{"id":"80ece3c7.fc5e3","type":"switch","z":"80f41e14.6c3d9","name":"Take or analyze picture","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"take picture","vt":"str"},{"t":"eq","v":"analyze picture","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":226.91668701171875,"y":1168.4333724975586,"wires":[["5fc8c968.44af"],["9429c95f.c90c7"]]},{"id":"c64ca440.fd9a68","type":"debug","z":"80f41e14.6c3d9","name":"","active":true,"console":"false","complete":"false","x":314.1666259765625,"y":1021.7332992553711,"wires":[]},{"id":"92b9be77.6f687","type":"template","z":"80f41e14.6c3d9","name":"Simpel result Table","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<style>\nh4 {\n text-align: center;\n margin: 10px;\n}\ntable {\n border: 1px solid black;\n width: 480px;\n}\n\nth, td {\n padding: 8px;\n text-align: left;\n border-bottom: 1px solid #ddd;\n width: 50%;\n}\n.classifier {\n background-color:LightBlue;\n text-align: center;\n}\n.title {\n background-color:LightGrey;\n}\n\n</style>\n <div align=\"center\">\n {{#result.images}}\n {{#classifiers}}\n <table border=\"1\">\n <tr><td class=classifier colspan=\"2\">{{classifier_id}}</td></tr>\n <tr><td class=\"title\">Name</td><td class=\"title\">Score</td></tr>\n {{#classes}}\n <tr><td><b>{{class}}</b></td><td><i>{{score}}</i></td></tr>\n {{/classes}}\n </table>\n {{/classifiers}}\n {{/result.images}}\n </div>","x":1236.16650390625,"y":1520.8666610717773,"wires":[["ccc319dc.e77d2","5daf5635.f128b8","8551b9e0.f16d7"]]},{"id":"ccc319dc.e77d2","type":"websocket out","z":"80f41e14.6c3d9","name":"","server":"110e61a2.4d53fe","client":"","x":1519.2996826171875,"y":1416.6000061035156,"wires":[]},{"id":"f651b238.922f1","type":"debug","z":"80f41e14.6c3d9","name":"","active":false,"console":"false","complete":"false","x":686.4583740234375,"y":1006.9999618530273,"wires":[]},{"id":"b540c61b.bdb428","type":"file in","z":"80f41e14.6c3d9","name":"","filename":"muskan.jpg","format":"","sendError":true,"x":329.7401123046875,"y":2246.1273193359375,"wires":[["4c615d4.feb0ba4","9d5928a6.2f8f5"]]},{"id":"4c615d4.feb0ba4","type":"function","z":"80f41e14.6c3d9","name":"Set Content-Type header","func":"msg.headers = {\n \"Content-Type\":\"image/jpeg\"\n};\nreturn msg;","outputs":1,"noerr":0,"x":645.7500915527344,"y":2350.5833740234375,"wires":[["5e4e518.3555c3"]]},{"id":"5e4e518.3555c3","type":"http response","z":"80f41e14.6c3d9","name":"","x":863.0830993652344,"y":2350.2503662109375,"wires":[]},{"id":"2ba7f999.785cee","type":"http in","z":"80f41e14.6c3d9","name":"","url":"/getimage","method":"get","swaggerDoc":"","x":114.75010681152344,"y":2248.5833740234375,"wires":[["b540c61b.bdb428"]]},{"id":"9d5928a6.2f8f5","type":"debug","z":"80f41e14.6c3d9","name":"","active":false,"console":"false","complete":"payload","x":714.7501678466797,"y":2216.583335876465,"wires":[]},{"id":"5daf5635.f128b8","type":"debug","z":"80f41e14.6c3d9","name":"","active":false,"console":"false","complete":"false","x":1486.708251953125,"y":1352.9999618530273,"wires":[]},{"id":"244b75a1.02b182","type":"template","z":"80f41e14.6c3d9","name":"Picture status","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<p>I've taken this picture. Now you can analyze it!</p>\n","x":657.1666259765625,"y":1076.0832748413086,"wires":[["2e31a243.c4f9be"]]},{"id":"2e31a243.c4f9be","type":"websocket out","z":"80f41e14.6c3d9","name":"","server":"f7a83a7d.5bf6b8","client":"","x":894.1666259765625,"y":1072.5832748413086,"wires":[]},{"id":"500feb29.18255c","type":"comment","z":"80f41e14.6c3d9","name":"Get Image","info":"","x":94.66673278808594,"y":2201.3333307902017,"wires":[]},{"id":"42323dd5.356c6c","type":"comment","z":"80f41e14.6c3d9","name":"WebApp","info":"","x":76.66665649414062,"y":864.9999618530273,"wires":[]},{"id":"d131df89.ea871","type":"comment","z":"80f41e14.6c3d9","name":"Take or analyze picture","info":"","x":105,"y":1021.9999618530273,"wires":[]},{"id":"7ac2407f.789d3","type":"function","z":"80f41e14.6c3d9","name":"Convert class to payload","func":"if (msg.classifier.valueOf().substr(0,10) == \"ibm_robots\")\n msg.payload = \"Hello, \" + msg.class + \", nice to meet you!\"\nelse\nnum = msg.score * 100\nmsg.score = num.toFixed(1)\n msg.payload = \"I am \"+ msg.score +\"% sure, that this is a \"+msg.class;\nreturn msg;","outputs":1,"noerr":0,"x":210.83343505859375,"y":1813.4940185546875,"wires":[["9495f02e.f0232"]]},{"id":"9495f02e.f0232","type":"watson-text-to-speech","z":"80f41e14.6c3d9","name":"IBM Watson - Text to Speech","lang":"es-LA","langhidden":"","langcustom":"NoCustomisationSetting","langcustomhidden":"NoCustomisationSetting","voice":"en-US_MichaelVoice","voicehidden":"","format":"audio/wav","password":"DAboiztBLcFv","x":508.8460388183594,"y":1813.6939697265625,"wires":[["fbbcc112.32996","301f68bc.9e719"]]},{"id":"cc757316.a28308","type":"file","z":"80f41e14.6c3d9","name":"","filename":"/home/pi/tmp/speech.wav","appendNewline":false,"createDir":true,"overwriteFile":"true","x":1062.1461486816406,"y":1913.61279296875,"wires":[[]]},{"id":"ffb390f3.314d1","type":"delay","z":"80f41e14.6c3d9","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":851.1461486816406,"y":2014.61279296875,"wires":[["a71d45ef.e47b8"]]},{"id":"a71d45ef.e47b8","type":"file in","z":"80f41e14.6c3d9","name":"","filename":"/home/pi/tmp/speech.wav","format":"","x":1067.1461486816406,"y":2014.61279296875,"wires":[["5d010ea0.8dbd88"]]},{"id":"5d010ea0.8dbd88","type":"exec","z":"80f41e14.6c3d9","command":"amixer cset numid=3 1 & aplay /home/pi/tmp/speech.wav","addpay":false,"append":"","useSpawn":"","timer":"","name":"","x":1462.1461486816406,"y":2013.1129150390625,"wires":[["802e9d5c.18173"],[],[]]},{"id":"fbbcc112.32996","type":"debug","z":"80f41e14.6c3d9","name":"","active":true,"console":"false","complete":"payload","x":900.1461334228516,"y":1812.61279296875,"wires":[]},{"id":"301f68bc.9e719","type":"function","z":"80f41e14.6c3d9","name":"Set playload to msg.speech","func":"msg.payload=msg.speech;\nreturn msg;","outputs":1,"noerr":0,"x":752.1461486816406,"y":1916.61279296875,"wires":[["cc757316.a28308","ffb390f3.314d1"]]},{"id":"161ae1c2.8c706e","type":"switch","z":"80f41e14.6c3d9","name":"","property":"indicator","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"str"},{"t":"eq","v":"1","vt":"str"}],"checkall":"true","outputs":2,"x":978.93310546875,"y":1499.400047302246,"wires":[["92b9be77.6f687"],["c339f6f0.ba67a8"]]},{"id":"c339f6f0.ba67a8","type":"template","z":"80f41e14.6c3d9","name":"No result found","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<p>I don't know what this is!</p>","x":1226.8665771484375,"y":1615.5333557128906,"wires":[["bfaef2e3.1c1de8"]]},{"id":"bfaef2e3.1c1de8","type":"websocket out","z":"80f41e14.6c3d9","name":"","server":"110e61a2.4d53fe","client":"","x":1479.6332397460938,"y":1625.6000061035156,"wires":[]},{"id":"8551b9e0.f16d7","type":"link out","z":"80f41e14.6c3d9","name":"Result table out","links":["9116a869.cd9e28"],"x":1438.8665771484375,"y":1532.3332824707031,"wires":[]},{"id":"9116a869.cd9e28","type":"link in","z":"80f41e14.6c3d9","name":"Text to speech in","links":["8551b9e0.f16d7"],"x":30.666656494140625,"y":1810.9999389648438,"wires":[["7ac2407f.789d3"]]},{"id":"1c682653.41cb62","type":"template","z":"80f41e14.6c3d9","name":"WebApp","field":"payload","fieldType":"msg","format":"html","syntax":"mustache","template":"<!DOCTYPE HTML>\n<html>\n <head>\n <title>Inventorix</title>\n <script type=\"text/javascript\">\n var ws;\n var wsUri = \"ws:\";\n var loc = window.location;\n console.log(loc);\n if (loc.protocol === \"https:\") { wsUri = \"wss:\"; }\n // This needs to point to the web socket in the Node-RED flow\n // ... in this case it's ws/simple\n wsUri += \"//\" + loc.host + loc.pathname.replace(\"tjvisual\",\"ws/tjvisual\");\n\n function showImage(){\n document.getElementById('loadingImage').style.visibility='visible';\n\n }\n \n function wsConnect() {\n console.log(\"connect\",wsUri);\n ws = new WebSocket(wsUri);\n var line = \"\"; // either uncomment this for a building list of messages\n //change IP Hotspot:192.168.43.231 Home:192.168.0.104 9.233.20.105\n ws.onmessage = function(msg) {\n var image = \"<img src='muskan.jpg\"+ new Date().getTime() + \"' alt='Picture' width='480px'/>\";\n console.log(image);\n document.getElementById('displayimage').innerHTML = image;\n // data from the http response from the visrec flow on bluemix\n var data = msg.data;\n console.log(data); //log output from visual rec analyzation\n line = data\n document.getElementById('messages').innerHTML = line;\n\n \n }\n ws.onopen = function() {\n // update the status div with the connection status\n document.getElementById('status').innerHTML = \"Websocket is connected and the app is ready to use.\";\n //ws.send(\"Open for data\");\n console.log(\"connected\");\n }\n ws.onclose = function() {\n \n // update the status div with the connection status\n document.getElementById('status').innerHTML = \"Websocket is not connected. Reconnecting in progress.\";\n // in case of lost connection tries to reconnect every 3 secs\n setTimeout(wsConnect,3000);\n }\n }\n \n function takepic(m) {\n if (ws) { ws.send(m); }\n console.log(\"taking picture\");\n }\n \n function analyze(m) {\n if (ws) { ws.send(m); }\n console.log(\"analyzing picture\");\n }\n </script>\n \n <style>\n body{\n padding-top: 45px;\n background: rgb(245,247,250);\n font-family:helvetica;\n font-size: 16px;\n }\n \n div {\n margin-top: 10px;\n }\n \n p {\n text-align: center;\n margin: 0;\n font-size: 16px;\n }\n \n hr {\n margin-top: 20px;\n margin-bottom: 20px;\n }\n \n #header {\n position: absolute;\n margin: 0;\n top: 0;\n left: 0;\n width: 100%;\n height: 50px;\n background: #f7b32d;\n box-sizing: border-box;\n color: #fff;\n font-size: 25px;\n text-align: center;\n vertical-align: middle;\n line-height: 50px;\n }\n \n #divbutton{\n margin: 0px;\n display:inline-block;\n \n }\n \n img {\n display: block;\n margin: auto;\n padding: 0px;\n }\n \n h1 {\n text-align: center;\n }\n\n button{\n padding:16px 20px;\n margin: auto;\n width: 200px;\n font-weight:100;\n color:#fff;\n font-size: 18px;\n background: #ea833d;\n border:0;\n }\n button:hover{\n background: rgb(0,102,87);\n }\n \n #status{\n font-size: 10px;\n position: relative;\n bottom: 0;\n text-align: center;\n }\n \n </style>\n \n </head>\n <body onload=\"wsConnect();\" onunload=\"ws.disconnect();\">\n <div id=\"header\">Inventorix</div>\n \n <div>\n <p>Inventorix is a IBM cloud based smart inventory management system which is backed by Visual recognition to keep track of Inventory.</p>\n <p>Now you can start taking a picture and analyze it with the Visual Recognition Service on IBM Bluemix.</p>\n </div>\n \n \n \n <div style=\"text-align:center\">\n <div id=\"divbutton\"><button type=\"button\" onclick='takepic(\"take picture\");'>Take a Picture</button></div>\n <div id=\"divbutton\"><button type=\"button\" onclick='analyze(\"analyze picture\");'>Analyze it</button></div>\n <button type =\"button\" value=\"\" onclick=\"showImage();\"> View Image </button>\n <img id=\"loadingImage\" src=\"muskan.jpg\" style=\"visibility:hidden\"/>\n <div id=\"displayimage\"></div>\n <div id=\"messages\"></div>\n <hr>\n <div id=\"status\">Websocket status unknown</div>\n </div>\n </body>\n</html>\n","output":"str","x":283.8125305175781,"y":916.9853744506836,"wires":[["c6d221dd.3e3108"]]},{"id":"d9d96e6f.aa0ab","type":"comment","z":"80f41e14.6c3d9","name":"Audio output result class with Text to Speech","info":"","x":175,"y":1746.8666381835938,"wires":[]},{"id":"9429c95f.c90c7","type":"change","z":"80f41e14.6c3d9","name":"Add Custom Classifier","rules":[{"t":"set","p":"params[\"classifier_ids\"]","pt":"msg","to":"ABB_Robots_2132214534,default","tot":"str"},{"t":"set","p":"processid","pt":"msg","to":"","tot":"date"}],"action":"","property":"","from":"","to":"","reg":false,"x":278.8333435058594,"y":1242.666648864746,"wires":[["1584442.0b439bc","97dc4f39.d2165"]]},{"id":"1584442.0b439bc","type":"debug","z":"80f41e14.6c3d9","name":"","active":true,"console":"false","complete":"true","x":744.87890625,"y":1172.7903060913086,"wires":[]},{"id":"1ddb6161.469947","type":"comment","z":"80f41e14.6c3d9","name":"Saves the image and the result to the archive folder","info":"","x":1195.125,"y":1259.9048690795898,"wires":[]},{"id":"fc4e25e8.6509a","type":"inject","z":"80f41e14.6c3d9","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":121.5,"y":1607.2499618530273,"wires":[["8d3ece3b.866dd8"]]},{"id":"8d3ece3b.866dd8","type":"function","z":"80f41e14.6c3d9","name":"","func":"//msg.payload = \"Hello. My name is TJ-Bot from IBM. With my cognitive capabilities I can analyze some pictures for you! I am looking forward to the H S L U students teaching me what I could be looking for.\"\nmsg.payload = \"Hello. My name is TJ-Bot from IBM. With my cognitive capabilities I can analyze some pictures for you!\" //I am looking forward to the A B B team teaching me what I could be looking for.\"\nreturn msg;","outputs":1,"noerr":0,"x":331.5,"y":1625.7499618530273,"wires":[["9495f02e.f0232"]]},{"id":"4f171971.4bf2e8","type":"inject","z":"80f41e14.6c3d9","name":"Test","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":110.5,"y":1667.2499618530273,"wires":[["cc17b9c2.45c068"]]},{"id":"cc17b9c2.45c068","type":"function","z":"80f41e14.6c3d9","name":"","func":"msg.payload = \"Hallo fmaily Miller, How are you?\"\n//msg.payload = \"Hello, This a voice test! How does my voice sound?\"\nreturn msg;","outputs":1,"noerr":0,"x":331,"y":1671.9999618530273,"wires":[["9495f02e.f0232"]]},{"id":"b5326a80.64e2b","type":"inject","z":"80f41e14.6c3d9","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":242.5,"y":875.9999618530273,"wires":[[]]},{"id":"da19ab23.370e6","type":"inject","z":"80f41e14.6c3d9","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":167.5,"y":2445,"wires":[["ec2100eb.299ab"]]},{"id":"82e20d64.a8d878","type":"debug","z":"80f41e14.6c3d9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":516.5,"y":2454,"wires":[]},{"id":"ec2100eb.299ab","type":"exec","z":"80f41e14.6c3d9","command":"pwd","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":328.5,"y":2454.5,"wires":[["82e20d64.a8d878"],["82e20d64.a8d878"],["82e20d64.a8d878"]]},{"id":"110e61a2.4d53fe","type":"websocket-listener","z":"","path":"/finalapp","wholemsg":"false"},{"id":"f7a83a7d.5bf6b8","type":"websocket-listener","z":"","path":"/ws/tjvisual","wholemsg":"false"}]