Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

🍲 AI-Powered Smart Food Waste Redistribution System

An intelligent, end-to-end Machine Learning and Optimization system built in Python. The system aims to predict food surplus from restaurants, forecast food demand in vulnerable regions, cluster high-waste and high-demand hotspots, and match and route surplus food to NGOs efficiently using Google OR-Tools.


📸 Project Showcase

(Recruiters: This project encompasses full-stack data science, from synthetic data generation and predictive modeling to interactive Streamlit dashboards and VRP route optimization.)

1. Dashboard Overview

Dashboard Overview Impact analytics showing total meals delivered, food saved, carbon footprint reduction, and AI Surplus Risk scores.

2. Geographic Hotspots & Routing

Map & Routes Folium maps highlighting restaurant and NGO locations, alongside Google OR-Tools optimized delivery routes.

3. Machine Learning Evaluation

ML Evaluation Actual vs. Predicted regression plots for waste prediction, and Random Forest feature importance charts.


✨ Key Features

  • Synthetic Data Generation: Simulates restaurants, NGOs, food surplus, and demand.
  • Machine Learning Models:
    • Waste Prediction: Predicts future surplus amounts and probabilities using Random Forest, Gradient Boosting, etc.
    • Demand Prediction: Forecasts food demand based on population density, poverty index, weather, and events.
    • Expiry Prediction: Estimates the risk of food spoiling based on distance, traffic, temperature, and food category.
    • Clustering: K-Means clustering to visualize high-waste and high-demand geographic hotspots.
  • AI Insights Module:
    • Live prediction engine assigning a "Surplus Risk %" to active restaurants.
  • Optimization Algorithms:
    • Intelligent Matching: Pairs restaurants with surplus food to the best-suited NGOs based on distance and capacity.
    • Route Optimization: Solves the Vehicle Routing Problem (VRP) / Traveling Salesman Problem (TSP) using Google OR-Tools to minimize volunteer fleet travel distance while fulfilling matched pickups and deliveries.
  • Interactive Dashboard: A Streamlit web application visualizing all predictions, clustered heatmaps, optimized routes, and impact analytics.

🛠️ Tech Stack

  • Language: Python
  • Data Manipulation & ML: pandas, numpy, scikit-learn
  • Optimization: ortools (Google OR-Tools)
  • Visualization & Dashboard: streamlit, plotly, folium, streamlit-folium

📂 Directory Structure

Smart_Food_Distribution/
│
├── data/                       # Generated synthetic datasets & clustering/matching results
├── docs/                       # Project documentation and screenshots
│   └── screenshots/
├── src/
│   ├── data_generator/         # Script to generate synthetic data
│   │   └── data_generator.py
│   ├── features/               # Feature engineering scripts
│   ├── models/                 # ML prediction and clustering scripts
│   │   ├── waste_prediction.py
│   │   ├── demand_prediction.py
│   │   ├── expiry_prediction.py
│   │   └── clustering.py
│   ├── optimization/           # Matching and Routing algorithms
│   │   ├── matching.py
│   │   └── routing.py
│   └── dashboard/              # Streamlit Web App
│       └── app.py
├── requirements.txt            # Python dependencies
└── README.md                   # Project documentation

🚀 How to Run the Project

1. Install Dependencies

Ensure you have Python installed. Run:

pip install -r requirements.txt
# Ensure new map libraries are installed
pip install folium streamlit-folium

2. Generate Data & Train Models

Run the pipeline to generate data, train ML models, and calculate optimization routes.

# 1. Generate Synthetic Data
python src/data_generator/data_generator.py

# 2. Train and Run Machine Learning Models
python src/models/waste_prediction.py
python src/models/demand_prediction.py
python src/models/expiry_prediction.py
python src/models/clustering.py

# 3. Run Optimization (Matching and Routing)
python src/optimization/matching.py
python src/optimization/routing.py

3. Launch the Dashboard

Finally, visualize the results by launching the Interactive Dashboard:

streamlit run src/dashboard/app.py

Open the URL provided in your terminal (usually http://localhost:8501) in your browser to explore the Impact Analytics, Heatmaps, and Optimized Routes maps.

4. Enable Live Google Maps Search

To fetch live nearby restaurants and NGOs for any searched city, add a Google Maps Platform API key using one of these options:

# Option 1: local .env file
copy .env.example .env

Then set:

GOOGLE_MAPS_API_KEY=your_google_maps_api_key_here

You can also provide the same key through Streamlit secrets in .streamlit/secrets.toml or an exported environment variable. The dashboard checks these sources in that order.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages