Skip to content

Instantly share code, notes, and snippets.

@kastentx
Created February 8, 2019 21:54
Show Gist options
  • Save kastentx/81f4933f27bd474af3e627dcaebba59a to your computer and use it in GitHub Desktop.
Save kastentx/81f4933f27bd474af3e627dcaebba59a to your computer and use it in GitHub Desktop.
backing up some nodeRED flows
[{"id":"6c24d4d6.57a15c","type":"tab","label":"MAX Audio Classifier Demo","disabled":false,"info":""},{"id":"549582d3.4a6d6c","type":"tab","label":"MAX Audio Classifier Demo","disabled":false,"info":""},{"id":"dcc29823.53cf28","type":"tab","label":"Image Caption Generator","disabled":false,"info":""},{"id":"4973299b.8bb7f8","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"d6b5216.e5535e","type":"audio-classifier-service","z":"","host":"https://max-audio-classifier.max.us-south.containers.appdomain.cloud","name":"Cloud Instance (Experimental)"},{"id":"7002d6eb.7cf098","type":"ui_tab","z":"","name":"Pi-NET","icon":"dashboard","disabled":false,"hidden":false},{"id":"cdb6bcc9.8067d","type":"ui_group","z":"","name":"Image Caption Generator","tab":"c4b530f9.dca8d","disp":true,"width":"14","collapse":false},{"id":"c4b530f9.dca8d","type":"ui_tab","z":"","name":"MAX Image Caption Generator","icon":"dashboard","disabled":false,"hidden":false},{"id":"40250a4f.f00254","type":"image-caption-generator-service","z":"4973299b.8bb7f8","host":"https://max-image-caption-generator.max.us-south.containers.appdomain.cloud","name":"cloud"},{"id":"43ecf1f7.b2546","type":"image-caption-generator-service","z":"","host":"https://max-image-caption-generator.max.us-south.containers.appdomain.cloud","name":"cloud"},{"id":"14a93db6.70af02","type":"ui_base","theme":{"name":"theme-dark","lightTheme":{"default":"#0094CE","baseColor":"#0094CE","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"darkTheme":{"default":"#097479","baseColor":"#097479","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"customTheme":{"name":"Untitled Theme 1","default":"#4B7930","baseColor":"#4B7930","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"},"themeState":{"base-color":{"default":"#097479","value":"#097479","edited":false},"page-titlebar-backgroundColor":{"value":"#097479","edited":false},"page-backgroundColor":{"value":"#111111","edited":false},"page-sidebar-backgroundColor":{"value":"#000000","edited":false},"group-textColor":{"value":"#0eb8c0","edited":false},"group-borderColor":{"value":"#555555","edited":false},"group-backgroundColor":{"value":"#333333","edited":false},"widget-textColor":{"value":"#eeeeee","edited":false},"widget-backgroundColor":{"value":"#097479","edited":false},"widget-borderColor":{"value":"#333333","edited":false},"base-font":{"value":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"}},"angularTheme":{"primary":"indigo","accents":"blue","warn":"red","background":"grey"}},"site":{"name":"Node-RED Dashboard","hideToolbar":"false","allowSwipe":"false","lockMenu":"false","allowTempTheme":"true","dateFormat":"DD/MM/YYYY","sizes":{"sx":48,"sy":48,"gx":6,"gy":6,"cx":6,"cy":6,"px":0,"py":0}}},{"id":"a0f4732b.adb67","type":"audio-classifier","z":"6c24d4d6.57a15c","service":"d6b5216.e5535e","method":"predict","predict_audio":"","predict_audioType":"str","name":"","x":413,"y":262,"wires":[["efd9424f.a04e4"]]},{"id":"88a099b5.42dc18","type":"fileinject","z":"6c24d4d6.57a15c","name":"","x":131,"y":330,"wires":[["a0f4732b.adb67"]]},{"id":"efd9424f.a04e4","type":"debug","z":"6c24d4d6.57a15c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":659,"y":262,"wires":[]},{"id":"aed4fef4.194c9","type":"microphone","z":"6c24d4d6.57a15c","name":"","x":140.5,"y":153,"wires":[["a0f4732b.adb67"]]},{"id":"5298fd04.1ffb44","type":"comment","z":"6c24d4d6.57a15c","name":"This flow shows the usage of the MAX Audio Classifier node (double-click for more...)","info":"This flow captures audio using your \ncomputer's microphone and sends it to \nthe MAX Audio Classifier Model, which \nidentifies what types of things are \nbeing heard. \n\nTo begin recording, click the button on the\nleft side of the 'microphone' node. To stop,\nclick the button again. \n\nYou should see a status message while the \naudio classifier node is processing the\nrequest, and then the output will appear in\nthe right-hand sidebar, in the 'Debug' console.\n\nAlternatively, you can upload a WAV file\nby double clicking the 'file inject' node. The\noutput will be the same.\n\nNOTE: This is only a demo of what this node \ncan do. With a little experimentation, you\nwill find many new ways to control the \ncapture of input, and ways to process the \nresponse and display it as output.","x":401.5,"y":69,"wires":[]},{"id":"42bd6b87.16c684","type":"audio-classifier","z":"549582d3.4a6d6c","service":"d6b5216.e5535e","method":"predict","predict_audio":"","predict_audioType":"str","name":"","x":413,"y":262,"wires":[["fb17ba10.4f9918"]]},{"id":"b18ff04c.bbe0b","type":"fileinject","z":"549582d3.4a6d6c","name":"","x":131,"y":330,"wires":[["42bd6b87.16c684"]]},{"id":"fb17ba10.4f9918","type":"debug","z":"549582d3.4a6d6c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":659,"y":262,"wires":[]},{"id":"bab1b3e0.9907e","type":"microphone","z":"549582d3.4a6d6c","name":"","x":140.5,"y":153,"wires":[["42bd6b87.16c684"]]},{"id":"1dbad8b9.1c2887","type":"comment","z":"549582d3.4a6d6c","name":"This flow shows the usage of the MAX Audio Classifier node (double-click for more...)","info":"This flow captures audio using your \ncomputer's microphone and sends it to \nthe MAX Audio Classifier Model, which \nidentifies what types of things are \nbeing heard. \n\nTo begin recording, click the button on the\nleft side of the 'microphone' node. To stop,\nclick the button again. \n\nYou should see a status message while the \naudio classifier node is processing the\nrequest, and then the output will appear in\nthe right-hand sidebar, in the 'Debug' console.\n\nAlternatively, you can upload a WAV file\nby double clicking the 'file inject' node. The\noutput will be the same.\n\nNOTE: This is only a demo of what this node \ncan do. With a little experimentation, you\nwill find many new ways to control the \ncapture of input, and ways to process the \nresponse and display it as output.","x":401.5,"y":69,"wires":[]},{"id":"39307139.f9cb3e","type":"debug","z":"dcc29823.53cf28","name":"Debug MAX Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":770,"y":140,"wires":[]},{"id":"5e235a0c.c0b094","type":"ui_button","z":"dcc29823.53cf28","name":"Capture Image Button (Dashboard)","group":"cdb6bcc9.8067d","order":7,"width":0,"height":0,"passthru":false,"label":"Capture Image","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":200,"y":160,"wires":[[]]},{"id":"e7c64d01.c2e5","type":"ui_text","z":"dcc29823.53cf28","group":"cdb6bcc9.8067d","order":5,"width":"14","height":"2","name":"","label":"Caption:","format":"{{msg.payload}}","layout":"col-center","x":1080,"y":260,"wires":[]},{"id":"7d6ccf89.959bc","type":"ui_template","z":"dcc29823.53cf28","group":"cdb6bcc9.8067d","name":"Image Display (Dashboard)","order":4,"width":"14","height":"9","format":"<div ng-bind-html='msg.payload'> </div>","storeOutMessages":false,"fwdInMessages":true,"templateScope":"local","x":1020,"y":300,"wires":[[]]},{"id":"216ff778.690168","type":"function","z":"dcc29823.53cf28","name":"base64 -> image element","func":"const b64 = msg.payload\nconst imgSrc = \"data:image/png;base64,\" + b64.toString('base64')\n\nconst element = \"<img src='\"+ imgSrc + \"' />\"\nmsg.payload = element\n\nreturn msg;","outputs":1,"noerr":0,"x":750,"y":260,"wires":[["7d6ccf89.959bc"]]},{"id":"c49ea931.76e0d8","type":"ui_template","z":"dcc29823.53cf28","group":"cdb6bcc9.8067d","name":"CSS Styles (Dashboard)","order":1,"width":0,"height":0,"format":"<style>\nimg {\n max-width: 85%;\n padding: 0;\n margin: auto;\n display: block;\n}\n</style>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"global","x":1030,"y":400,"wires":[[]]},{"id":"68c05d1a.fa22c4","type":"comment","z":"dcc29823.53cf28","name":"This flow captures an image using the Raspberry Pi Camera and sends it to a MAX Model, then displays the output on the NodeRED Dashboard.","info":"","x":580,"y":60,"wires":[]},{"id":"65de0e31.65e32","type":"inject","z":"dcc29823.53cf28","name":"Click to Capture Image","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":280,"wires":[[]]},{"id":"611c6ed0.deb03","type":"image-caption-generator","z":"dcc29823.53cf28","service":"43ecf1f7.b2546","method":"predict","predict_body":"","predict_bodyType":"str","name":"","x":750,"y":200,"wires":[["39307139.f9cb3e","e7c64d01.c2e5"]]},{"id":"e1c7f02b.16266","type":"image","z":"dcc29823.53cf28","name":"Image Capture Output","width":200,"x":580,"y":380,"wires":[]},{"id":"6d664219.99b2ac","type":"fileinject","z":"dcc29823.53cf28","name":"","x":482,"y":192,"wires":[["611c6ed0.deb03","216ff778.690168","e1c7f02b.16266"]]},{"id":"9d6d1e93.bf33","type":"http request","z":"4973299b.8bb7f8","name":"","method":"POST","ret":"txt","url":"http://max-object-detector.max.us-south.containers.appdomain.cloud/model/predict","tls":"","x":652,"y":3643,"wires":[["a1d8e4b3.857e18"]]},{"id":"74c1752e.a3007c","type":"fileinject","z":"4973299b.8bb7f8","name":"","x":194,"y":3675,"wires":[["5377f2af.2804cc"]]},{"id":"a1d8e4b3.857e18","type":"debug","z":"4973299b.8bb7f8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":753,"y":3747,"wires":[]},{"id":"5377f2af.2804cc","type":"function","z":"4973299b.8bb7f8","name":"","func":"let payload = { 'image': {\n 'value': msg.payload,\n 'options': {\n 'filename': 'image.png'\n \n }\n }\n}\nmsg.headers = {'Content-Type': 'multipart/form-data'}\nmsg.payload = payload\nreturn msg","outputs":1,"noerr":0,"x":362,"y":3733,"wires":[["9d6d1e93.bf33"]]},{"id":"a4027c8d.c0d7f","type":"http request","z":"4973299b.8bb7f8","name":"","method":"GET","ret":"txt","url":"","x":579,"y":202,"wires":[[]]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment