Prerequisites
Python Prerequisites
Python Prerequisites
- Python 3.6+ -
requests
library (install withpip install requests
)
Node.js Prerequisites
Node.js Prerequisites
- A recent Node.js version -
axios
library (install withnpm install axios
)
Code Example
This example demonstrates how to use the Food Analysis API to analyze a food image. We’ll show how to do this in both Python and Node.js.- Encode an image file to base64.
- Prepare the payload with the encoded image data.
- Send a POST request to the
/scanImage
endpoint. - Process the response, handling both successful analyses and potential errors.
"path/to/your/image.jpg"
with the actual path to your image file, and ensure you have the necessary libraries installed (requests
for Python, axios
for Node.js).