IBM-TeleLens (Visual Recognition Telegram bot)

IBM Visual Recognition Telegram bot.

Send pictures to a Telegram bot and receive the classification results back from the IBM Visual Recognition service.

[{"id":"25f8997.aabf866","type":"tab","label":"Visual Rec","disabled":false,"info":""},{"id":"80c9fac7.212158","type":"change","z":"25f8997.aabf866","name":"Extract image URL","rules":[{"t":"set","p":"payload","pt":"msg","to":"url","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":160,"wires":[["45944bb7.ddb584"]]},{"id":"45944bb7.ddb584","type":"visual-recognition-v3","z":"25f8997.aabf866","name":"","image-feature":"classifyImage","lang":"en","x":610,"y":220,"wires":[["32f65b0b.a20954"]]},{"id":"7ad06f3d.dd94a","type":"telegram receiver","z":"25f8997.aabf866","name":"","bot":"c33c41c5.6ac62","saveDataDir":"","x":130,"y":200,"wires":[["97f6b893.c74da8"],[]]},{"id":"e457ef1.c90b11","type":"telegram sender","z":"25f8997.aabf866","name":"","bot":"c33c41c5.6ac62","x":950,"y":420,"wires":[[]]},{"id":"32f65b0b.a20954","type":"function","z":"25f8997.aabf866","name":"Get Results","func":"result=[];\nmsg.result.images[0].classifiers.forEach(function(current_value, index, initial_array) {\n          current_value.classes.forEach(function(current_value,index,initial_array){\n              result.push(current_value.class);\n          });\n        });\nmsg.verbal=result.toString();\nreturn msg;","outputs":1,"noerr":0,"x":590,"y":300,"wires":[["a4d5c107.81f3d"]]},{"id":"a4d5c107.81f3d","type":"function","z":"25f8997.aabf866","name":"Prepare Message","func":"msg.payload = {\n    chatId : msg.chatId,\n    type : \"message\",\n    content : msg.verbal\n    \n};\nreturn msg;","outputs":1,"noerr":0,"x":810,"y":340,"wires":[["e457ef1.c90b11"]]},{"id":"97f6b893.c74da8","type":"function","z":"25f8997.aabf866","name":"Check Message","func":"msg.chatId= msg.payload.chatId;\n\nimageurl = encodeURI(msg.payload.weblink);\nmsg.url=imageurl;\nreturn msg;","outputs":3,"noerr":0,"x":160,"y":380,"wires":[["45ec041c.5031bc"],[],[]]},{"id":"49738c04.8a4e94","type":"function","z":"25f8997.aabf866","name":"Prepare Message","func":"msg.payload.content = 'Please upload a picture or image'\n\nreturn msg;","outputs":1,"noerr":0,"x":510,"y":420,"wires":[["e457ef1.c90b11"]]},{"id":"45ec041c.5031bc","type":"switch","z":"25f8997.aabf866","name":"Check if image","property":"payload.type","propertyType":"msg","rules":[{"t":"eq","v":"photo","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":320,"y":280,"wires":[["80c9fac7.212158"],["49738c04.8a4e94"]]},{"id":"c33c41c5.6ac62","type":"telegram bot","z":"","botname":"IBM_TeleLens_bot","usernames":"","chatids":"","baseapiurl":"","updatemode":"polling","pollinterval":"300","usesocks":false,"sockshost":"","socksport":"6667","socksusername":"anonymous","sockspassword":"","bothost":"","localbotport":"8443","publicbotport":"8443","privatekey":"","certificate":"","useselfsignedcertificate":false,"verboselogging":false}]

Flow Info

Created 5 years, 10 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • change (x1)
  • function (x4)
  • switch (x1)
Other

Tags

  • AI
  • Visual
  • Recognition
  • telegram
  • bot
  • picture
  • images
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option