Before beginning this example, ensure that you have satisfied the following prerequisites.
- A valid trainML account with a non-zero credit balance
- A python virtual environment with the trainML CLI/SDK installed and configured.
- A current version of Node.js installed.
To create an endpoint using the simple tensorflow classifier example with the necessary route configured, run the following command from a python virtual environment with the trainML CLI/SDK installed and configured
python deploy_endpoint.py
Once the endpoint is running, it will print the endpoint URL to use in the subsequent steps.
To get a prediction for the endpoint from the command line, you can use the classify_image.sh
bash script in the repository. Simply specify the endpoint address from above and the path to a file you want to predict as the two arguments. For example:
./classify_image.sh <endpoint_address> ./images/pizza.jpg
Open the file front-end/src/config.js
with a text editor. Change the api_address
value to the endpoint URL from the previous step and save the file. If you changed the route path in the previous step, you must also update that here.
Go to the front-end
folder of the repository in a terminal window and type npm install
. Once the package installation is complete, run npm start
. This will open a web browser to http://localhost:3000 and load the example front end. Click the Upload File
button and select an image to classify (example image files are in the images
folder of this repository). Click Get Prediction
to send the file to the endpoint. When the response comes back, the list of the top five class categories and their confidence rating will be displayed on the right. Click Upload New File
and Get Prediction
on additional images as desired.