Simple example how to run AI service on flask server.
ENVIRONMENT:
flask: 2.0.2
tensorflow: 2.3.0
AI model: squeezenet.h5 https://github.com/oracle/graphpipe/blob/master/docs/models/squeezenet.h5
- Install all required packages
pip install -r requirements.txt
- Run script service-app.py:
python3 service-app.py
WARNING!!!
Server has set parameter host to value "0.0.0.0" - it means that server is publicly available
- Test running server - run web browser and go to http://localhost/healthcheck.
Server should response Health Check OK:
You can use cURL
- Go to test_data folder
- Execute this:
curl -X POST --data-binary @g3.png "http://localhost/imageClassification" -H "accept: application/json" -H "Content-Type: application/octet-stream"
- Expected json response format:
{"classification": <label>}