food-ingredient-analysis
v1.0.0
Published
Food ingredient analysis tool based on FastMCP framework, capable of analyzing food packaging images and extracting nutritional information
Downloads
107
Maintainers
Readme
Food Ingredient Analysis Tool
A FastMCP-based tool for analyzing food packaging images and extracting nutritional information.
Features
- Analyze food packaging images
- Extract ingredients and nutritional information
- Generate structured data and human-readable reports
- Support for multiple image URLs
- Configurable API key support
Installation
npm install @my-company/food-ingredient-analysisUsage
As a Module
const { analyze_food_package_images } = require('@my-company/food-ingredient-analysis');
const result = await analyze_food_package_images({
image_urls: ['http://example.com/image1.jpg', 'http://example.com/image2.jpg'],
api_key: 'your-dashscope-api-key' // Optional, can use DASHSCOPE_API_KEY environment variable
});As a Service
Start the service:
npm startThe service will be available at http://localhost:8080.
To analyze images, send a POST request to http://localhost:8080/analyze:
curl -X POST http://localhost:8080/analyze \
-H "Content-Type: application/json" \
-d '{
"image_urls": ["http://example.com/image1.jpg"],
"api_key": "your-dashscope-api-key"
}'API Reference
analyze_food_package_images(options)
Analyzes food packaging images and extracts nutritional information.
Options
image_urls(array, required): Array of food packaging image URLsapi_key(string, optional): DashScope API key for authentication. If not provided, the function will use the DASHSCOPE_API_KEY environment variable.
Returns
An object containing:
structured_data: Structured JSON data with nutritional informationmarkdown_report: Human-readable markdown report
Environment Variables
DASHSCOPE_API_KEY: DashScope API key for authenticationPORT: Port to run the service on (default: 8080)
License
MIT
