Spaces:
Running
Running
metadata
license: mit
title: Food Analyzer API
sdk: docker
emoji: 🔥
colorFrom: red
colorTo: purple
pinned: true
short_description: Fast API
FoodAnalyzer-API
Installation and Setup
Clone the repository:
git clone https://github.com/prathameshks/FoodAnalyzer-API.gitNavigate to the project directory:
cd FoodAnalyzer-APICreate a virtual environment:
python -m venv venvActivate the virtual environment:
- On Windows:
venv\Scripts\activate - On macOS/Linux:
source venv/bin/activate
- On Windows:
Install dependencies:
pip install -r requirements.txtSet up environment variables: Copy the
.env.examplefile to.envand fill in the required values, including API keys for Hugging Face Transformers.Run the application:
uvicorn main:app --reload
API Endpoints
Authentication
POST /api/auth/register: Register a new user.POST /api/auth/login: Login and obtain an access token.GET /api/auth/user: Get the current user's information.
Ingredient Analysis
POST /api/analyze/analyze_ingredients: Analyze a list of ingredients.GET /api/analyze/personalized_recommendations: Get personalized ingredient recommendations.
Scan History
POST /api/history/scan: Record a new scan.GET /api/history/scan/{user_id}: Retrieve the scan history for a user.
Alembic migrations
To create a new migration, run the following command:
alembic init migrations
To generate a new migration file, run:
alembic revision --autogenerate -m "Message"
To apply the migration, run:
alembic upgrade head
To downgrade the migration, run:
alembic downgrade -1
To view the current migration version, run:
alembic current