Author: Basith
This Flask application provides an API for uploading and analyzing food images using Firebase Firestore and LogMeal API. It also allows logging food items to a diet log collection.
-
Image Upload and Analysis
- Upload images of food items for nutritional analysis.
- Preprocess images and send them to LogMeal API to retrieve nutritional data.
-
Diet Logging
- Add meals with nutritional data to a diet log collection.
- Retrieve and display the history of scanned food items and diet logs.
-
Chatbot Integration
- Implement a chatbot using GenerativeAI to respond to user messages.
- Flask
- firebase-admin
- Pillow (PIL)
- requests
- google.generativeai (Google LLM Library)
Ensure the following environment variables are set:
API_TOKEN
: LogMeal API tokenGEMINI_API_KEY
: Gemini API key for GenerativeAI
-
Clone the repository:
git clone https://github.com/MuhammedBasith/food-lens-backend.git cd food-lens-backend
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
- Create a
.env
file and defineAPI_TOKEN
andGEMINI_API_KEY
.
- Create a
-
Start the Flask server:
python server.py
-
Upload Image
POST /api/upload-image
: Upload and analyze an image of a food item.
-
Add to Diet Log
POST /api/add-to-diet
: Log a meal with nutritional data to the diet log.
-
Get Scanned Items History
GET /api/get-scanned-items
: Retrieve the history of scanned food items.
-
Get Diet Logs for Calendar
GET /api/calendar/diet-logs
: Retrieve diet logs for display on a user calendar.
-
Chatbot Interaction
POST /api/chatbot
: Interact with a chatbot to generate responses using GenerativeAI.
This project is licensed under the MIT License - see the LICENSE file for details.