File size: 2,354 Bytes
fa84113
 
 
 
 
 
 
 
 
 
6802b2f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dd14920
 
 
 
 
 
 
 
 
 
 
6802b2f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ea4a457
 
 
 
 
 
 
 
 
 
 
 
6802b2f
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
---
title: Waste Classifier
emoji: ♻️
colorFrom: green
colorTo: gray
sdk: streamlit
sdk_version: 1.25.0
pinned: false
---

# Waste Classifier Streamlit App

## Overview

The Waste Classifier Streamlit App is designed to detect waste in images using the EfficientDet and classify them with a fine-tuned resnet50 model into different classes. Users can upload an image containing trash, and the app will display both the uploaded and classified images in parallel columns.

## Instructions

### Installation

Make sure you have Python installed. Clone the repository and navigate to the project directory:

```bash
git clone <repository_url>
cd <project_directory>
```

Create a virtual environment and install dependencies:

```bash
python -m venv venv-waste-classifier
source venv-waste-classifier/bin/activate  # On Windows, use 'venv-waste-classifier\Scripts\activate'
pip install -r requirements.txt
```
Create a `.env` file and set the following properties:

- CLAS_FILENAME --> The name of the waste classificator model checkpoint
- DET_FILENAME --> The name of the waste detector model checkpoint
- HF_DET_REPO_NAME --> The huggingface repository name of the detector model
  - For example: [rootstrap-org/waste-detector](https://huggingface.co/rootstrap-org/waste-detector)
- HF_CLAS_REPO_NAME --> The huggingface repository name of the classifier model
  - For example: [rootstrap-org/waste-classifier](https://huggingface.co/rootstrap-org/waste-classifier)

You can ommit setting the last two properties if you download the models manually and put them under the `models` directory.


### Running the App

Execute the Streamlit app with the following command:

```bash
streamlit run app.py
```

This will launch a local development server, and you can access the app in your web browser at `http://localhost:8501`.

### Usage

1. Upload an image with trash using the provided file uploader.
2. The app will display the uploaded image in the left column.
3. Click the "Classify trash" button to initiate the classification process.
4. The classified image will be displayed in the right column.

## Possible Classes

The app can classify waste into the following classes:

- Cardboard
- Compost
- Glass
- Metal
- Paper
- Plastic
- Trash

## Dependencies

- Streamlit
- Pillow
- Other dependencies as specified in the `requirements.txt` file.