Code Monkey home page Code Monkey logo

George the memebot

Deploying George on Bluemix

Note that the first two steps were automatically done for you if you used the Deploy to Bluemix button. You still need to train George, though.

Create the natural language classifier instance

$ cf create-service natural_language_classifier free george-classifier

Deploy your Bluemix application

Assuming you want to call your app my-own-george:

$ cf push my-own-george

This will make your app available at http://my-own-george.mybluemix.net (or http://my-own-george.eu-gb.mybluemix.net if you're using the UK region).

But until the classifier is trained, George won't be able to answer any questions.

How to train your robot

First you need to retrieve the credentials for the classifier service you created above. You can find them on the Bluemix console if you look hard enough, or you can find them by dumping the application's environment with this command (substituting my-own-george with your app name, of course):

$ cf env my-own-george
…
{
 "VCAP_SERVICES": {
  "natural_language_classifier": [
   {
    "credentials": {
     "password": "ppppppppppp",
     "url": "https://gateway.watsonplatform.net/natural-language-classifier-experimental/api",
     "username": "uuuuuuuu-uuuu-uuuu-uuuu-uuuuuuuuuuuu"
    },
…

Armed with these username and password, you can now create a classifier instance, by using the corpus.json provided with George:

$ curl -Ss -u uuuuuuuu-uuuu-uuuu-uuuu-uuuuuuuuuuuu:ppppppppppp \
    -H "Content-Type:application/json" \
    -d @corpus.json \
    https://gateway.watsonplatform.net/natural-language-classifier/api/v1/classifiers
{
  "classifier_id": "ABCDEF-nlc-123",
  "name": null,
  "created": "2015-06-24T12:56:58.555Z",
  "url": "https://gateway.watsonplatform.net/natural-language-classifier/api/v1/classifiers/ABCDEF-nlc-123",
  "status": "Training",
  "status_description": "The classifier instance is in its training phase, not yet ready to accept classify requests"
}

As you can see, the classifier is training itself. It will stay like this for a few minutes.

However, now that we have a classifier ID (ABCDEF-nlc-123 above), we don't have to wait to configure our application to use it:

$ cf set-env my-own-george CLASSIFIER_ID ABCDEF-nlc-123
$ cf restage my-own-george

Once the classifier is ready (which you can easily check by accessing its full URL as returned above), George should be ready to answer questions.

Anytime you change corpus.json, you will have to train a new classifier instance, and update your app's CLASSIFIER_ID environment variable accordingly.

See here for the full Natural Language Classifier API reference.

Olivier Barrot's Projects

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.