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, runpip install pip==9.0.3
inside your project's activated virtualenv to downgrade pip.
- This requires pip version 9.0.3, so type
- Install ASK CLI:
npm install -g ask-cli
orsudo 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
anddev.sh
inside your project'sapp
directory. Never commit these files.- In
config.py
, fill inSKILL_ID
with your dev-elf's skill ID. - No need to change anything in
dev.sh
(yet).
- In
- 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:
- 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.
- If it is your first time serving the web app locally, run
flask upload_model
- 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. - 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!
- Upload the interaction model by filename:
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
- Alexa Skills Kit
- ASK CLI Command Reference (see
update-model
)
Flask
- Flask (a Python micro-framework)
- Flask-Ask (Alexa integration)
- Sample Flask-Ask apps
- NB: The structure of the files in speech_assets is outdated.
- Sample Flask-Ask apps
- Flask-Dynamo (DynamoDB integration)
- Jinja2 templating language (for
templates.yml
)