EcoSnap is a Python-based web application for waste classification and sustainability recommendations. It provides both a user-friendly Gradio interface and a FastAPI backend. Users can upload waste images or enter textual queries to classify waste types and receive eco-friendly tips.
- 🖼️ Image Upload & Waste Classification
- 📊 Interactive Gradio UI with Earth-to-Sky theme
- 🌍 Sustainability recommendations via RAG (Retrieval-Augmented Generation)
- 🔌 FastAPI backend for programmatic access
- 🔧 Local FAISS-based vector store with HuggingFace embeddings
- Python 3.x
- Gradio
- FastAPI
- LangChain & HuggingFace Embeddings
- FAISS vector store
- Pandas, NumPy, Matplotlib
- PIL (Pillow)
├── app.py # Gradio UI and front-end logic
├── model.py # FastAPI app, RAG setup, and classification API
├── sustainability_data/
│ └── plastic_general_info.txt # Sample sustainability docs
├── faiss_index/ # Saved FAISS index (created at runtime)
└── requirements.txt # Python dependencies
-
Clone the repository
git clone https://github.com/thrishank007/EcoSnap.git cd EcoSnap -
Create and activate a virtual environment
python3 -m venv venv source venv/bin/activate -
Install dependencies
pip install -r requirements.txt
python app.pyOpen the displayed local URL (e.g., http://localhost:7860) in your browser to interact with the EcoSnap UI.
uvicorn model:app --reloadBy default, the API will run at http://127.0.0.1:8000. Endpoints:
POST /classify-image/– Upload an image to classify waste.POST /recommend/– Send a text prompt to get sustainability tips via RAG.
API docs: http://127.0.0.1:8000/docs
On first run, the app generates mock sustainability data under ./sustainability_data/. You can replace these with your own .txt documents:
- Create
.txtfiles insustainability_data/ - RAG will ingest them and build/update
faiss_index/
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License. See LICENSE for details.
Created by @thrishank007.
Feel free to reach out with feedback or questions.