Food Pulse is a web application designed to bridge the gap between restaurants, NGOs, and old-age homes to minimize food wastage.
It uses AI-driven freshness prediction and a built-in FAQ + AI chatbot to ensure surplus food is redistributed safely and efficiently.
- π§ AI-Powered Shelf Life Prediction:
Uses Groqβs LLaMA-3.3-70B Versatile model to estimate freshness duration (in hours) of any food item. - π€ Smart Hybrid Chatbot (FoodPulseChatbot):
Combines FAQ-based responses with real-time AI chat via Groq API for accurate, context-aware assistance. - π΄ Restaurant Dashboard:
Restaurants can list surplus food and track freshness automatically. - π NGO / Old Age Home Dashboard:
NGOs can view, claim, and collect food items safely. - π§βπΌ Admin Dashboard:
Admins can oversee users, listings, and platform activity. - π Secure Authentication:
Passwords are hashed securely usingwerkzeug.security.
π DBMS FINAL WEB/
β
βββ π static/ # Static assets (CSS, JS, images)
βββ π templates/ # HTML templates for Flask
βββ π app.py # Main Flask application
βββ π chatbot.py # Hybrid FAQ + AI Chatbot logic
βββ π database.db # SQLite3 database
βββ π init_db.py # Database initialization script
βββ π schema.sql # SQL schema for tables
βββ π .env # Environment variables (Groq API key)
βββ π .gitignore # Git ignore configuration
βββ π **pycache**/ # Auto-generated Python cache files
git clone https://github.com/yourusername/food-pulse.git
cd "DBMS FINAL WEB"python -m venv venv
source venv/bin/activate # For Linux/Mac
venv\Scripts\activate # For Windowspip install flask groq python-dotenv werkzeug requestsCreate a .env file in the root directory:
GROQ_API_KEY=your_groq_api_key_here
FLASK_ENV=development
python init_db.pyThis script executes schema.sql and creates the database.db file.
python app.pyThen open your browser and visit π http://127.0.0.1:5000
- When a restaurant adds food, the system calls Groqβs LLaMA-3.3 model to estimate its safe shelf life in hours.
- The freshness duration (
fresh_until) is computed automatically and stored in the database. - Once expired, listings are automatically marked Expired.
| Column | Type | Description |
|---|---|---|
| id | INTEGER | Primary key |
| name | TEXT | Userβs name |
| TEXT | Unique email | |
| password | TEXT | Hashed password |
| account_type | TEXT | restaurant / ngo / old-age-home / admin |
| address | TEXT | Address of organization |
| phone_number | TEXT | Contact number |
| is_profile_complete | INTEGER | 1 if user added details |
| Column | Type | Description |
|---|---|---|
| id | INTEGER | Primary key |
| restaurant_id | INTEGER | ID of restaurant |
| food_item | TEXT | Item name |
| quantity | TEXT | Quantity info |
| status | TEXT | Available / Claimed / Expired |
| fresh_until | DATETIME | Calculated freshness expiry |
| claimed_by_id | INTEGER | NGO/Old-age-home that claimed it |
| timestamp | DATETIME | Time when food was listed |
The chatbot combines instant FAQ answers with AI-powered responses from the Groq API:
- First checks against a local FAQ dataset (organized by category).
- If no strong match is found, it dynamically queries Groqβs LLaMA 3.1 model using contextual information about the Food Pulse platform.
- It uses conversation history, rate limiting, and keyword filtering to stay accurate and efficient.
- π§© FAQ Matching: Matches user queries with a curated set of pre-defined questions and answers (e.g., registration, logistics, food safety).
- π¬ AI Context Replies: Falls back to Groq API with a structured system prompt that includes Food Pulseβs documentation and mission.
- βοΈ Rate Limiting: Prevents abuse (1 request/second, 100 requests/day limit).
- π§ Memory: Retains the last 6 exchanges for contextual understanding.
- π§Ή Topic Filtering: Ignores unrelated queries and redirects the user politely.
POST /chat
{
"message": "How can NGOs request food donations?"
}{
"reply": "NGOs can browse approved listings, filter based on their needs, and click 'Request' to claim an item. The restaurant receives a notification, and upon confirmation, pickup or delivery arrangements can be made."
}If the question is outside the FAQ, the chatbot will automatically fetch a contextual AI response using Groq API.
| Template | Purpose |
|---|---|
index.html |
Landing page |
login.html |
Login and signup |
restaurant_dashboard.html |
Dashboard for restaurants |
ngo_dashboard.html |
Dashboard for NGOs and old-age homes |
admin_dashboard.html |
Admin overview panel |
profile.html |
User profile setup |
- π§Ύ Add donation tracking and feedback system
- π¦ Introduce geolocation-based restaurantβNGO matching
- β‘ Integrate real-time freshness sensors via IoT
- π€ Make chatbot context-aware with multi-turn reasoning
- π Add analytics for food distribution impact
Developed by: Spandan Chakraborty, Sarbatriki Jana, Souhardya Ray, Sreejani Banik & Saraddyuti Chakravarty
Focus Areas: AI Integration, Backend Logic, and Sustainable Solutions
This project is licensed under the MIT License β free to use, modify, and distribute with proper attribution.