Skip to content

SrivathsanRam/food2vec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Food2Vec 🍕

An AI-powered food discovery application that uses vector similarity search to find similar foods.

Project Structure

HacknRoll/
├── backend/           # Flask API server
│   ├── app.py         # Main Flask application
│   ├── requirements.txt
│   └── .env.example   # Environment variables template
│
└── frontend/          # React application
    ├── public/
    ├── src/
    │   ├── components/
    │   │   ├── LandingPage.js
    │   │   ├── SearchBar.js
    │   │   └── SearchResults.js
    │   ├── App.js
    │   └── index.js
    └── package.json

Features

  • 🔍 Smart Autocomplete - Real-time food suggestions as you type
  • 🤖 AI-Powered Search - Vector similarity search using Pinecone
  • Instant Results - Fast and responsive search experience
  • 📱 Responsive Design - Works on desktop and mobile

Getting Started

Prerequisites

  • Python 3.8+
  • Node.js 16+
  • Pinecone account (optional, has mock data fallback)

Backend Setup

  1. Navigate to the backend directory:

    cd backend
  2. Create a virtual environment:

    python -m venv venv
  3. Activate the virtual environment:

    • Windows: venv\Scripts\activate
    • Mac/Linux: source venv/bin/activate
  4. Install dependencies:

    pip install -r requirements.txt
  5. Add the environment file and add your Supabase conn key:

    SUPABASE_URL=URL
    SUPABASE_KEY=KEY
    
    FLASK_ENV=development
    FLASK_DEBUG=1
    
    OPENAI_API_KEY=KEY

Edit .env with your Supbase credentials.

  1. Run the Flask server:
python app.py

The backend will run on http://localhost:5000

Frontend Setup

  1. Navigate to the frontend directory:

    cd frontend
  2. Install dependencies:

    npm install
  3. Start the development server:

    npm run dev

    The frontend will run on http://localhost:3000

API Endpoints

Endpoint Method Description
/api/health GET Health check
/api/autocomplete?q=<query> GET Get food suggestions
/api/search POST Search for similar foods
/api/categories GET Get all food categories

Supabase Setup (Optional)

To enable real vector search:

  1. Create a Supabase account at https://supabase.com/
  2. Create a new project
  3. Enable the pgvector extension in your database (Database → Extensions → enable vector)
  4. Create a table for food vectors
  5. Add your Supabase URL and key to the .env file:
   SUPABASE_URL=your_project_url
   SUPABASE__KEY=your_anon_key
  1. Populate the table with food embeddings

Technologies Used

  • Backend: Flask, Flask-CORS, Supabase
  • Frontend: React, CSS3
  • Vector Database: Pinecone

About

Hack&Roll 2026 - A Recipe-Aware Vector Embedding Generation for Food

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors