Deploy the model

Now it's the moment when you are going to make your bot go live!  While using Rasa you don't need to write any API services, it is all available in the package itself. So to expose the trained model as service you need to execute the following command which takes the path of the stored trained model:

python -m rasa_nlu.server --path projects

If everything goes fine then a RESTfull API will be exposed at port 5000 and you can see this log on the console screen.

2018-05-23 21:34:23+0530 [-] Log opened.
2018-05-23 21:34:23+0530 [-] Site starting on 5000
2018-05-23 21:34:23+0530 [-] Starting factory <twisted.web.server.Site instance at 0x1062207e8>

To access the API you can use the following command. We are querying the model asking a question as  "I am looking for a Mexican food":

curl -X POST localhost:5000/parse -d '{"q":"I am looking for Mexican food"}' | python -m json.tool


Output:
{
"entities": [
{
"confidence": 0.5348393725109971,
"end": 24,
"entity": "cuisine",
"extractor": "ner_crf",
"start": 17,
"value": "mexican"
}
],
"intent": {
"confidence": 0.7584285478135262,
"name": "restaurant_search"
},
"intent_ranking": [
{
"confidence": 0.7584285478135262,
"name": "restaurant_search"
},
{
"confidence": 0.11009204166074991,
"name": "goodbye"
},
{
"confidence": 0.08219245368495268,
"name": "affirm"
},
{
"confidence": 0.049286956840770876,
"name": "greet"
}
],
"model": "model_20180523-213216",
"project": "default",
"text": "I am looking for Mexican food"
}

So here we can see that model has performed quite accurately with the intent classification and the entity extraction process. It is able to classify the intent as restaurant_search with 75.8% of accuracy and it is also able to detect cuisine entity with value as mexican.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.239.182