Skip to main content

Getting Started

This guide will help you set up and run the AI Ingredient Scanner on your machine.

Prerequisitesโ€‹

RequirementVersion
Python3.11+
Node.js18+ (for mobile app)
Google Cloud API keyGemini
Qdrant Cloud accountFree tier available

Backend Setupโ€‹

1. Clone Repositoryโ€‹

git clone https://github.com/udaytamma/AiIngredientScanner.git
cd AiIngredientScanner

2. Create Virtual Environmentโ€‹

python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate

3. Install Dependenciesโ€‹

pip install -r requirements.txt

4. Configure Environmentโ€‹

Create a .env file in the project root:

# Required
GOOGLE_API_KEY=your_gemini_api_key
QDRANT_URL=your_qdrant_cloud_url
QDRANT_API_KEY=your_qdrant_api_key

# Optional
REDIS_URL=your_redis_connection_string
LANGCHAIN_API_KEY=your_langsmith_api_key
Getting API Keys

5. Verify Connectionsโ€‹

python test_connections.py

6. Run the Applicationโ€‹

Option A: Streamlit Web Interface

streamlit run app.py

Option B: REST API (for mobile app)

uvicorn api:app --host 0.0.0.0 --port 8000

Mobile App Setupโ€‹

See the Mobile App Setup Guide for detailed instructions.

Quick Startโ€‹

cd mobile
npm install

# Update API URL in src/services/api.ts
# Replace with your machine's IP address

npx expo start
# Scan QR code with Expo Go app

First Analysisโ€‹

  1. Open the Streamlit interface at http://localhost:8501
  2. Enter a product name (optional)
  3. Paste an ingredient list
  4. Configure your profile (allergies, skin type)
  5. Click Analyze
  6. View your personalized safety report!

Project Structureโ€‹

AiIngredientScanner/
โ”œโ”€โ”€ app.py # Streamlit web interface
โ”œโ”€โ”€ api.py # FastAPI REST endpoints
โ”œโ”€โ”€ graph.py # LangGraph workflow
โ”œโ”€โ”€ agents/ # AI agents
โ”‚ โ”œโ”€โ”€ research.py # Ingredient research
โ”‚ โ”œโ”€โ”€ analysis.py # Report generation
โ”‚ โ”œโ”€โ”€ critic.py # Quality validation
โ”‚ โ””โ”€โ”€ supervisor.py # Workflow routing
โ”œโ”€โ”€ tools/ # Utility tools
โ”œโ”€โ”€ prompts/ # LLM prompts
โ”œโ”€โ”€ config/ # Configuration
โ”œโ”€โ”€ mobile/ # React Native app
โ””โ”€โ”€ tests/ # Test suite

Next Stepsโ€‹

Troubleshootingโ€‹

Common Issuesโ€‹

"Cannot connect to Qdrant"

  • Verify your QDRANT_URL and QDRANT_API_KEY are correct
  • Check your network connection

"API key not valid"

  • Ensure GOOGLE_API_KEY is set correctly
  • Check if the key has Gemini API access enabled

"Module not found"

  • Activate your virtual environment
  • Run pip install -r requirements.txt again