REST API for review sentiment and natural image classification web app.
- install dependencies running
pip install -r requirements.txt - get basilica API key and input into basilica scripts
- navigate to
trainingdirectory - run both basilica scripts
python basilica_scripty.pypython basilica_image_script.py
- run build model script
python build_model.py both
- run
export FLASK_APP=review_api.py - setup db
flask db initflask db migrate -m "setting up db"flask db upgrade
- run app:
flask run
ex request json:
{
"review": "Text of the review"
}
ex response json:
{
"class": "positive"/"negative",
"confidence": 1-0,
"review": "text of the review"
}
request body has image named as "file".
ex response json:
{
"class": "airplane"/"person"/"car"/"cat"/"dog"/"fruit"/"flower"/"motorbike",
"confidence": 1-0
}
ex request json:
{
"answer": "correct"/"incorrect",
"prediction": "positive"/"negative"
}
ex response json:
{
"total": int,
"true_positives": int,
"true_negatives": int,
"false_positives": int,
"false_negatives": int
}