Building Cognitive Apps powered by Watson and Bluemix

Hello and Welcome.

In this Lab we’re going to use Cognitive Computing powered by Watson with cloud innovation platform Bluemix to create an application that answers questions on subjects like Healthcare and Travel.

Cognitive computing is the next era of IT as we make great strides towards computing that can understand or comprehend similar to how we humans do. It’s incredibly complex and sophisticated, cutting-edge stuff. But don’t worry, with Bluemix and Node-Red it’s going to be ridiculously easy to build some cool apps that use it.

Seriously it will be easy.

Let’s get started.

1. Quick Guide to Cognitive Computing

We’re going to use Cognitive Computing that has been already trained with general knowledge on Travel and Healthcare topics.

We can decide how we want to collect these questions – it could be tweeted, texted, emailed, sent via a Mobile app, even spoken. Also we can decide how we want the answers to be delivered – again through Twitter, SMS, email, voice etc.

2. Deploying Node-Red

First let’s deploy Node-Red (if you don’t already have it running) in Bluemix.

It’s going to be really easy.

  • Log in to Bluemix.
  • Click on the Catalog link at the top.

1

  • Find the Node-Red Starter service in the Boilerplates section near the top and click on it.

2

The Node-Red Starter will give us a really cool visual programming tool, that’s great for rapid prototyping of apps. The tool will generate Javascript apps that run on Node.js.

Bluemix’s Node-Red Starter service will deploy a Node.js runtime, a Cloudant NoSQL database and a monitoring service all in one click.

  • Give your Node-Red service a name and hit create.

 4

Bluemix will now create and deploy your Node.js runtime, Cloudant NoSQL database in the cloud. That was easy!

  • Now click on the big red button to open up the Node-Red editor.

5

You’ll have a nice, shiny new place where we can rapidly build cool Bluemix apps.

Just like this…

w1

3. Deploying Cognitive Computing in Bluemix

We’re now going to use Bluemix to deploy our Watson service that answers questions on subjects like Travel and Healthcare.

Go back to the Bluemix catalog.

1

Find the Watson Bluemix services.

w2

Click on the Question and Answer service.

w3

You won’t need to come up with a name for it – but you’ll want to bind it to your Node-Red app.

To do this, click on the drop down box under App: that defaults to Leave unbound.

Choose your Node-Red instance. w5

Now hit Create.

pic9

Good.  So now you have an instance of the Watson Question and Answer service deployed in Bluemix and bound to Node-Red, ready for us to build some Watson-powered apps.

Go back to your Node-Red editor.

w1

And find the Watson Nodes… These enable us to incorporate the Watson services into our Apps.

Using other Watson Nodes in Node-Red

Note that to use any of these Watson Nodes in Node-Red you first need to deploy the corresponding service in Bluemix and bind these with Node-Red, as we just did with the Question and Answer service.

Now let’s use Node-Red to create programs that ask and answer questions.

Start by finding the Watson nodes.

w6

Click on the Question and Answer node and drag it onto the canvas. w8

Double click on the Question and Answer node to configure it.

Here you can choose the “specialist subject” you want to answer questions on. This Watson service in Bluemix has been trained with general knowledge on Travel or Healthcare.

Of course Watson can be trained to become an expert on specific subjects such as travel to a particular part of the world or certain aspects of healthcare such as Oncology, or any other topic where you need an expert.

To find about more about how Watson is trained see this video

Ok – so choose which you’d like to ask questions on. I’m starting with travel.

w7

To test the Watson Question and Answer service let’s start by sending in some test questions and displaying Watson’s top response in the debug console.

Find and drag some Inject nodes onto the canvas.

w9

Double click on each Inject node, change the Payload type to string and compose a question to ask Watson. I like to name the Inject node with the question too.

w12

Repeat for as many Inject nodes as you like to ask as many questions as you want.

Go crazy. Have some fun. No really, go on.

Remember that you need to ask questions. Statements aren’t questions. And questions need to end with question marks.

w10

Wire all your Inject node questions into the Question and Answer node.

Now add a Debug node to the canvas and wire the output of the Question and Answer node into the Debug node.

w11

Cool. Now Deploy your first Cognitive Computing app!

13

Now make sure you’re displaying the Debug console.

w13

Now click on the Inject node buttons (the grey boxes on the left of the Inject nodes) to submit your questions to Watson and check the Debug console for the answers.

w14

Check out the answer Watson gives in the Debug Console.

w15

Not bad!

Try some more questions…

w16 w17 w18 w19 w20 w21

Yeah! Awesome!

Now imagine a travel agent that could give you helpful travel advice 24/7 through email, SMS text message, WhatsApp message, Twitter, etc…

If you want to display your question on the Debugconsole as well as the answer, wire your Inject nodes into Debugnodes too.

OK, let’s now try the Healthcare knowledge base.

Drag another Watson Question and Answer node to the canvas.w8

Configure it for the Healthcare corpus.

w7

Create more Inject nodes and configure these with Healthcare questions.

w22

Check out the answers.

w23 w24 w25

Now think of other ways to interact with the Watson Question and Answer service.

You can inject more questions through email with the Email node, through a Web app with the http node and even listening to questions posted on Twitter with the Twitter input node.

For submitting questions via Twitter you’ll want to set up a #hashtag which you monitor for the questions with Twitter input node. Then when the tweets come in, you’ll want to strip off the #hashtag so that Watson isn’t confused by it.

Hope you enjoyed this lab.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s