In this tutorial we will walk through creating a simple web application with Python and the Flask framework backed by AI/ML Algorithms from Modzy.
- Download the project code.
- Download or clone the Modzy Flask Template from Github: https://github.com/modzy/modzy_flask_template
- Open a terminal window and navigate to the Modzy Flask Template directory you just downloaded.
- Install Python
- Install Flask
- If you already have Flask installed, you may skip this step.
- Verify that your terminal is in the Modzy Flask Template folder.
- First we will create a virtual environment to contain this project. Enter
python3 -m venv venvinto the terminal and press enter.
- After the command completes, type
source venv/bin/activateand press enter.
- Now type
pip install flask flask-wtfand hit enter.
- Install Modzy-SDK
pip install modzy-sdkto your terminal and press enter.
- Retrieve your Modzy API key. It is a good idea to create a new project and use the project's API key to better organize and monitor activity related to this application.
- If you are using Linux or Mac, type
export API_KEY=yourAPI_keyand hit enter. If using a Windows terminal,
set API_KEY=yourAPI_key. Alternatively, you may edit the
API_KEY_Public.API_KEY_Privatewith your downloaded API Key.
- Finally, start Flask with the command
- Open your new Web server!
- Using a web browser of your choice, navigate to http://127.0.0.1:5000/
- You should see this in your brower:
- Use the application
- Type any text into the 'My Text' box and hit Analyze.
- A few seconds later, the results of the sentiment analysis will be displayed!
Updated about 2 months ago
Did this page help you?