Skip to content
This repository was archived by the owner on Dec 5, 2023. It is now read-only.

BangkitC23-PC673/nutriary-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nutriary API Documentation

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.

Introduction

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.

Getting Started

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 /predict to 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.

Usage

POST /predict

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/step

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "class": "rendang",
    "probability": 95.85497379302979
}

Error Handling

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.

About

API deployment using railway and NIXPACKS

Resources

Stars

Watchers

Forks

Languages