
The Gradio-based web application for waste classification.

The classification output showing the predicted waste category.
This project is an AI-powered trash classification system that identifies different types of waste: cardboard, glass, metal, paper, plastic, and trash. It includes:
- Dataset preparation & upload to Hugging Face.
- Model training using ResNet18.
- Deployment of a Gradio app on Hugging Face Spaces.
🔗 Live Demo: Smart-Waste-Classifier-App
- Key Features
- Technology Stack
- Project Structure
- Installing & Running
- Processing Pipeline
- Data Analysis
- Deployment Steps
- References
- License
-
Automated Waste Classification
- Supports cardboard, glass, metal, paper, plastic, trash.
- Uses ResNet18 for classification.
-
Robust Data Processing
- Dataset pre-processing and augmentation.
- Normalization and resizing for ResNet.
-
Fast Deployment
- Hosted on Hugging Face Spaces.
- Runs efficiently in a lightweight environment.
- Python 3.12+
- PyTorch & Torchvision
- Gradio for UI
- Hugging Face Hub for dataset & model storage
Smart_Waste_Classification_Project/
├── README.md
├── images/
│ ├── cardboard.jpg
│ ├── The_apps.png
│ ├── The_result.png
├── data/
│ ├── train/
│ ├── val/
├── model.pth
├── train.py
├── app.py
├── hf_upload_dataset_model.py
├── hf_deploy_space.py
├── requirements.txt
└── .env
pip install --upgrade huggingface_hub transformers requests tqdm torch torchvision gradio python-dotenvCreate a .env file and add:
HF_TOKEN=hf_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXpython hf_upload_dataset_model.pyThis uploads:
✅ Dataset → Smart-Waste-Dataset-Reduced
✅ Model → Smart-Waste-Classifier-ResNet18
graph TD
A[Image Input] --> B[Data Preprocessing]
B --> C[Feature Extraction]
C --> D[ResNet18 Model]
D --> E[Classification Output]
- Preprocess images (resize, normalize).
- Extract features using ResNet18.
- Classify into six categories.
Prediction: Cardboard (75%)
Top 3 Classes:
1. Cardboard - 75%
2. Paper - 21%
3. Trash - 2%
python hf_deploy_space.pyThis deploys to Hugging Face Spaces: ✅ Live App → Smart-Waste-Classifier-App
Copyright (c) 2023 Fahmi Zainal
This project is licensed for personal and educational use only. Modification and redistribution require explicit permission from the author.
🚀 Enjoy using Smart Waste Classifier!