Simple text classifier API.
Classifies English text into Positive
or Negative
.
Examples
History tells us of glorious friendships in the ancient world.
isPositive
There was a man with tongue of wood Who essayed to sing, And in truth it was lamentable
isNegative
.Here one of the most atrocious massacres of the West took place.
isNegative
What should it be but the most magnificent palace that had ever been seen in the world.
isPositive
Make a POST
request to http://datahangar.net/api
with form-data
field text
-> string
i.e. Today was a wonderful day.
should return Positive
- Trains a Deep Neural Network classifier with 50K IMDB reviews
- Saves the trained model in a /data folder in the parent directory
- Uses flask for serving an API accepting
POST
requests with a text field - Responds with 'Positive' or 'Negative'
- Install requirements with
pip3 install -r requeriments.txt
, etc. - Train the model, might require some time depending on computing power, simple as running the script
python3 DNNClassifier.py
, you can train it locally and then upload the data folder to your server. - Export flask app,
export FLASK_APP=$(pwd)/api.py
- Run it with
flask run
- Make a
POST
request tohttp://127.0.0.1:5000/api
withform-data
fieldtext
and some text, i.e.Today was a wonderful day
, should returnPositive
.