A Python desktop application that uses AI-powered image recognition to classify household waste into different categories.
Welcome screen
Initial state
Classification example 1
Classification example 2
This application helps users identify and classify household garbage into four main categories:
| Category | Examples |
|---|---|
| Recyclable | Paper, plastic bottles, metal cans, glass |
| Food Waste | Organic/compostable materials |
| Dry Garbage | Non-recyclable, non-hazardous waste |
| Hazardous | Batteries, chemicals, electronics |
Built as a learning project to explore cloud APIs and image recognition technology.
- Frontend: Tkinter (Python GUI)
- Backend: Python 3.7+
- Image Processing: Pillow (PIL)
- Cloud Services: Alibaba Cloud (OSS + Vision API)
- Data Storage: CSV (local cache)
- Python 3.7 or higher
- Alibaba Cloud account with OSS and Image Recognition API enabled
1. Clone the repository
git clone https://github.com/chengwanru/Garbage-sorting-program.git
cd Garbage-sorting-program2. Install dependencies
pip install -r requirements.txt3. Configure API credentials
cp config.py.example config.pyEdit config.py with your Alibaba Cloud credentials
4. Run the application
python code.py- Launch the app - a welcome screen appears for 5 seconds
- Click "Select Picture" to choose an image file
- Preview appears in the center of the window
- Click "Classification" to analyze the image
- Result displays below the buttons (cached for future use)
The application follows a simple workflow:
- User selects an image from their local computer
- System checks if the image was previously classified (CSV cache)
- If not cached, the image is uploaded to Alibaba Cloud OSS
- Cloud Vision API analyzes and classifies the image
- Results are translated from Chinese to English and displayed
- Classification is saved locally to avoid redundant API calls
Key Features:
- Local file selection via file dialog
- Cloud-based image processing
- Automatic result caching to reduce API costs
- Real-time image preview
Implemented CSV caching to store results and avoid redundant API calls. Each image is only classified once.
API returns Chinese category names which are automatically translated to English using a mapping dictionary.
Made with Python



