Welcome to the Nutriary API documentation. This API allows you to classify Indonesian food images using TensorFlow, providing information about the predicted food class and its corresponding probability.
The Nutriary API is designed to assist users in identifying and categorizing Indonesian food items from images. By leveraging the power of TensorFlow, a popular deep learning framework, the API can accurately classify food images and provide valuable insights into their nutritional value.
To get started with the Nutriary API, follow these steps:
- Make sure to use the full HTTPS URL to access the API, for example
https://nutriary-api.up.railway.app - use
POST /predictto submit an image for classification. This endpoint accepts image files as input and returns the predicted food class along with the probability. - Set the request content type to
multipart/form-data. - Include the food image file in the request payload with a key named
file. - Send the request and wait for the response.
- Receive the response from the API, which will contain the predicted class and probability of the food item.
- Process and utilize the classification results according to your application's requirements.
Submit an image file for classification. The request should be made using the multipart/form-data content type, with the image file attached as file field.
Example Request:
POST /predict HTTP/1.1
Content-Type: multipart/form-data;
Content-Disposition: form-data; name="file"; filename="food_image.jpg"
Content-Type: image/jpeg
1/1 [==============================] - ETA: 0s
1/1 [==============================] - 0s 32ms/stepExample Response:
HTTP/1.1 200 OK
Content-Type: application/json
{
"class": "rendang",
"probability": 95.85497379302979
}In case of an error, the API will respond with an appropriate HTTP status code and an error message in the response body. Please refer to the response codes and messages to identify and handle errors correctly.