tsnaomi / mental-elf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mental-Elf

Let's talk.

Web app

Welcome to the Mental Elf Flask app!


Getting started

  • Install the latest Python packages: pip install -r requirements.txt
    • This requires pip version 9.0.3, so type pip -V to check your pip version. If you have a never version of pip, run pip install pip==9.0.3 inside your project's activated virtualenv to downgrade pip.
  • Install ASK CLI: npm install -g ask-cli or sudo npm install -g ask-cli
  • Initialize ASK CLI: ask init
  • Go into your Alexa Skills Kit console and create a Mental Elf Dev skill (henceforth, dev-elf). This skill will only be used when you work on the project locally.
  • Place config.py and dev.sh inside your project's app directory. Never commit these files.
    • In config.py, fill in SKILL_ID with your dev-elf's skill ID.
    • No need to change anything in dev.sh (yet).
  • Watch this video and learn how to set up ngrok with the Alexa Skills Kit. Don't worry about the other stuff in the video.

Running the web app locally

Inside the app directory:

  1. Run source dev.sh to imbue your environment with the necessary variables.
    • Do this in any terminal window in which you'd like to interact with the web app.
  2. If it is your first time serving the web app locally, run flask upload_model
  3. In a separate terminal window, run ./ngrok http 5000 and use the given HTTPS url as dev-elf's endpoint in the Alexa Skills Kit console.
  4. Run flask run to start the web server locally. Voila! Now you can test out Mental Elf in the Alexa Skills Kit console.

Flask commands

  • Start the web server locally: flask run
  • Upload the interaction model: flask upload_model
    • Upload the interaction model by filename: flask upload_model --filename MODEL_FN
    • Update the model before uploading it: flask upload_model —-update
    • Thus, if you want to test out a new interaction model design without destroying the current ./speech_assets/InteractionModel.json, you can run something like the following:
      • flask upload_model --filename test-model.json --update
      • This will build the interaction model and save it as test-model.json, then upload it to dev-elf!

Training rasa nlu and rasa core

read the readmes in respective folders

Usage of rasa nlu and rasa core

the models are loaded into app.py both can be independently used. However rasa core internally uses the trained NLU model, you just feed the text received from alexa raw text. See comments in the code


Documentation + resources

Alexa + AWS

Flask

EC2 alternatives

  • Zappa (server-less Lambda-based Python web services)
  • Heroku (cloud platform for web services)

Tutorials

Hao's repos

About


Languages

Language:Python 100.0%