forked from markwatsonatx/ibm-finish-line
-
Notifications
You must be signed in to change notification settings - Fork 0
/
classify-nodered-flow.json
1 lines (1 loc) · 3.46 KB
/
classify-nodered-flow.json
1
[{"id":"f1529292.f744d","type":"tab","label":"Visual Recognition","disabled":false,"info":""},{"id":"3ec6ff5d.4d68e","type":"visual-recognition-v3","z":"f1529292.f744d","name":"","apikey":"__PWRD__","image-feature":"classifyImage","lang":"en","x":375.5,"y":380,"wires":[["71158241.2940ac","ab8c5629.7012b8"]]},{"id":"71158241.2940ac","type":"debug","z":"f1529292.f744d","name":"","active":true,"console":"false","complete":"true","x":530.5,"y":458,"wires":[]},{"id":"2b9881d7.49a3be","type":"http in","z":"f1529292.f744d","name":"","url":"/classify","method":"get","upload":false,"swaggerDoc":"","x":132.5,"y":131,"wires":[["a236695f.350ba8"]]},{"id":"bd38888f.3e7248","type":"http response","z":"f1529292.f744d","name":"","statusCode":"","headers":{},"x":479.5,"y":131,"wires":[]},{"id":"a236695f.350ba8","type":"template","z":"f1529292.f744d","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<html>\n\n<head>\n <style>\n body {\n font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n font-size: 14px;\n color: #333;\n }\n .form-control {\n padding: 6px 12px;\n font-size: 14px;\n border: 1px solid #ccc;\n border-radius: 4px;\n }\n </style>\n <script>\n function onFileSelected(e) {\n var file = e.target.files[0];\n var reader = new FileReader();\n reader.onload = function(e) {\n document.getElementById('submitBtn').style.visibility = 'visible';\n document.getElementById('imgContainer').innerHTML = '<img style=\"height: 200px; border: 1px solid #000; margin: 5px\" src=\"' + e.target.result + '\"/>';\n };\n reader.readAsDataURL(file);\n }\n function onBodyLoaded() {\n document.getElementById('fileToUpload').addEventListener('change', onFileSelected, false);\n }\n </script>\n</head>\n\n<body onLoad=\"onBodyLoaded();\">\n <form action=\"/classify\" method=\"post\" enctype=\"multipart/form-data\">\n <p>\n <input type=\"file\" class=\"form-control\" name=\"fileToUpload\" id=\"fileToUpload\">\n </p>\n <p>\n <output id=\"imgContainer\"></output> \n </p>\n <p>\n <input id=\"submitBtn\" type=\"submit\" class=\"form-control\" style=\"visibility: hidden;\" value=\"Upload Image\" name=\"submit\">\n </p>\n </form>\n</body>\n\n</html>","output":"str","x":307.5,"y":131,"wires":[["bd38888f.3e7248"]]},{"id":"d0e90f00.7cd58","type":"http in","z":"f1529292.f744d","name":"","url":"/classify","method":"post","upload":true,"swaggerDoc":"","x":124.5,"y":211,"wires":[["ac340418.d05aa8"]]},{"id":"ab8c5629.7012b8","type":"template","z":"f1529292.f744d","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<html>\n\n<head>\n <style>\n body {\n font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n font-size: 14px;\n color: #333;\n }\n </style>\n</head>\n\n<body>\n <h2>Image Classification</h2>\n <h3>{{ result.images.0.classifiers.0.classes.0.class }}</h3>\n <h3>{{ result.images.0.classifiers.0.classes.0.score }}</h3>\n</body>\n\n</html>","output":"str","x":514,"y":290,"wires":[["1689b3b8.e7f81c"]]},{"id":"1689b3b8.e7f81c","type":"http response","z":"f1529292.f744d","name":"","statusCode":"","headers":{},"x":649,"y":229,"wires":[]},{"id":"ac340418.d05aa8","type":"function","z":"f1529292.f744d","name":"","func":"msg.payload = msg.req.files[0].buffer;\nreturn msg;","outputs":1,"noerr":0,"x":235.5,"y":295,"wires":[["3ec6ff5d.4d68e"]]}]