This flow is a example of how to use a customize model created on Watson Knowledge Studio in Watson Natural Language Understanding. You have to previously created a custom model on WKS, get de customer model and updated the function node before NLU node.
-
-
Save sergiogama/c3f02a6c73e8ed214fbb4e359096d8d8 to your computer and use it in GitHub Desktop.
How to use a custom model on Watson Natural Language Understanding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{"id":"9eaaea7b.ca4988","type":"twitter in","z":"604e990b.798cb8","twitter":"","tags":"#ibmquartatech","user":"false","name":"","topic":"tweets","inputs":0,"x":122.5,"y":111,"wires":[["a82e2b6e.7cc298"]]},{"id":"5a2307a.dd8b4f8","type":"debug","z":"604e990b.798cb8","name":"","active":true,"console":"false","complete":"payload","x":643,"y":184,"wires":[]},{"id":"7655c602.1a4388","type":"natural-language-understanding","z":"604e990b.798cb8","name":"NLU","categories":false,"concepts":false,"maxconcepts":"8","doc-emotion":true,"doc-emotion-target":"","doc-sentiment":true,"doc-sentiment-target":"","entity":true,"entity-emotion":false,"entity-sentiment":false,"maxentities":"50","keyword":false,"keyword-emotion":false,"keyword-sentiment":false,"maxkeywords":"50","metadata":false,"relation":true,"semantic":false,"semantic-entities":false,"semantic-keywords":false,"maxsemantics":"50","x":437.5,"y":321,"wires":[["981091ce.222ca","f940463a.087ab8","fdf406cc.e66c78","36306e64.367172"]]},{"id":"e327aa24.ada078","type":"inject","z":"604e990b.798cb8","name":"","topic":"","payload":"Eu sou o Sérgio Gama e nasci em Janeiro de 1967 e moro em São Paulo desde 2010. Eu trabalho na IBM desde 2009 e meu irmão no Google desde Jan/2006","payloadType":"str","repeat":"","crontab":"","once":false,"x":132.5,"y":321,"wires":[["b5ddeeb4.2344"]]},{"id":"981091ce.222ca","type":"debug","z":"604e990b.798cb8","name":"","active":true,"console":"false","complete":"features","x":689.5,"y":320,"wires":[]},{"id":"b5ddeeb4.2344","type":"function","z":"604e990b.798cb8","name":"","func":"msg = \n{payload:msg.payload,nlu_options:\n{entity_model:\"10:48b15d17-5302-43fd-b552-637dcd8ad0d0\",\n relations_model:\"10:48b15d17-5302-43fd-b552-637dcd8ad0d0\" \n}};\nreturn msg;","outputs":1,"noerr":0,"x":325.5,"y":258,"wires":[["7655c602.1a4388"]]},{"id":"a82e2b6e.7cc298","type":"change","z":"604e990b.798cb8","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"#ibmquartatech","fromt":"str","to":"","tot":"str"},{"t":"set","p":"nome","pt":"global","to":"tweet.user.name","tot":"msg"},{"t":"set","p":"foto","pt":"global","to":"tweet.user.profile_image_url","tot":"msg"},{"t":"set","p":"local","pt":"global","to":"tweet.user.location","tot":"msg"},{"t":"set","p":"texto","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":203.5,"y":189,"wires":[["b5ddeeb4.2344","cd19fb08.d2d6d8","b7e53bfa.84fa58","4ed6c5c4.1ccabc","c221a03e.4f37","61fd21e7.10b07"]]},{"id":"cd19fb08.d2d6d8","type":"function","z":"604e990b.798cb8","name":"","func":"msg.payload = msg.tweet.user.name + \": \" + msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":418.5,"y":187,"wires":[["5a2307a.dd8b4f8","d4b6745b.aa7678"]]},{"id":"d4b6745b.aa7678","type":"debug","z":"604e990b.798cb8","name":"","active":true,"console":"false","complete":"true","x":541.5,"y":76,"wires":[]},{"id":"3902a271.89303e","type":"ui_gauge","z":"604e990b.798cb8","name":"","group":"9d36eeb.b87231","order":0,"width":0,"height":0,"gtype":"gage","title":"Qtde","label":"Qtde","format":"{{value}}","min":0,"max":"500","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":482.5,"y":480,"wires":[]},{"id":"b7e53bfa.84fa58","type":"function","z":"604e990b.798cb8","name":"","func":"context.global.cont = context.global.cont || 0;\ncontext.global.cont++;\nmsg.payload = context.global.cont;\nreturn msg;","outputs":1,"noerr":0,"x":363.5,"y":406,"wires":[["3902a271.89303e"]]},{"id":"4c1f0052.d4755","type":"ui_text","z":"604e990b.798cb8","group":"fe5fedc5.a68e5","order":0,"width":"6","height":"1","name":"","label":"Nome","format":"{{msg.payload}}","layout":"row-spread","x":468.5,"y":563,"wires":[]},{"id":"4ed6c5c4.1ccabc","type":"function","z":"604e990b.798cb8","name":"","func":"msg.payload = context.global.nome;\nreturn msg;","outputs":1,"noerr":0,"x":305.5,"y":502,"wires":[["4c1f0052.d4755"]]},{"id":"50482ac2.fba304","type":"ui_text","z":"604e990b.798cb8","group":"fe5fedc5.a68e5","order":0,"width":"6","height":"1","name":"","label":"Local","format":"{{msg.payload}}","layout":"row-spread","x":492,"y":653,"wires":[]},{"id":"c221a03e.4f37","type":"function","z":"604e990b.798cb8","name":"","func":"msg.payload = context.global.local;\nreturn msg;","outputs":1,"noerr":0,"x":329,"y":592,"wires":[["50482ac2.fba304"]]},{"id":"a7120875.e94748","type":"ui_template","z":"604e990b.798cb8","group":"fe5fedc5.a68e5","name":"","order":0,"width":0,"height":0,"format":"<img src=\"{{msg.payload}}\" alt=\"usuario\" style=\"width:304px;height:228px;\">","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":454.5,"y":731,"wires":[[]]},{"id":"61fd21e7.10b07","type":"function","z":"604e990b.798cb8","name":"","func":"msg.payload = context.global.foto;\nreturn msg;","outputs":1,"noerr":0,"x":319,"y":698,"wires":[["a7120875.e94748"]]},{"id":"c2b04687.6e6338","type":"ui_text","z":"604e990b.798cb8","group":"f1fcdfea.64c55","order":0,"width":"6","height":"5","name":"","label":"Texto","format":"{{msg.payload}}","layout":"col-center","x":706.5,"y":396,"wires":[]},{"id":"f940463a.087ab8","type":"function","z":"604e990b.798cb8","name":"","func":"msg.payload = context.global.texto;\nreturn msg;","outputs":1,"noerr":0,"x":542.5,"y":378,"wires":[["c2b04687.6e6338"]]},{"id":"1e0cecc9.4ab853","type":"ui_text","z":"604e990b.798cb8","group":"f1fcdfea.64c55","order":0,"width":"6","height":"8","name":"","label":"Resultado (NLU)","format":"{{msg.payload}}","layout":"col-center","x":741.5,"y":445,"wires":[]},{"id":"fdf406cc.e66c78","type":"function","z":"604e990b.798cb8","name":"","func":"msg.payload = msg.features;\nreturn msg;","outputs":1,"noerr":0,"x":542.5,"y":435,"wires":[["1e0cecc9.4ab853"]]},{"id":"86f3acce.99f47","type":"http in","z":"604e990b.798cb8","name":"","url":"/teste","method":"get","upload":false,"swaggerDoc":"","x":82.27272727272727,"y":257.27272727272725,"wires":[["eb725c9f.935ce"]]},{"id":"eb725c9f.935ce","type":"change","z":"604e990b.798cb8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"req.query.texto","tot":"msg"},{"t":"set","p":"resAux","pt":"global","to":"res","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":125.90909576416016,"y":396.3636302947998,"wires":[["b5ddeeb4.2344"]]},{"id":"b8324a6c.e56d48","type":"http response","z":"604e990b.798cb8","name":"","statusCode":"","headers":{},"x":741.3636363636363,"y":254.54545454545453,"wires":[]},{"id":"36306e64.367172","type":"change","z":"604e990b.798cb8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"features","tot":"msg"},{"t":"set","p":"res","pt":"msg","to":"resAux","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":599.5454545454545,"y":284.5454545454545,"wires":[["b8324a6c.e56d48"]]},{"id":"9d36eeb.b87231","type":"ui_group","z":"","name":"Participantes","tab":"1bbbb30e.48fecd","disp":true,"width":"6"},{"id":"fe5fedc5.a68e5","type":"ui_group","z":"","name":"Último usuario","tab":"1bbbb30e.48fecd","disp":true,"width":"6"},{"id":"f1fcdfea.64c55","type":"ui_group","z":"","name":"Texto","tab":"1bbbb30e.48fecd","disp":true,"width":"6"},{"id":"1bbbb30e.48fecd","type":"ui_tab","z":"","name":"Quarta-Tech","icon":"dashboard"}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment