File size: 1,561 Bytes
e8f3f13
dbede1c
 
 
 
 
 
 
 
 
 
ed8cfa9
dbede1c
 
e8f3f13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
82
83
84
85
86
87
88
89
90
91
92
93
94

---
title: Trash Classifier
emoji: πŸš€
colorFrom: pink
colorTo: purple
sdk: gradio
sdk_version: 5.35.0
app_file: app.py
pinned: false
license: mit
short_description: Classify trash into 6 Categories with 90 percent accuracy
---

# 🧠 Trash Classifier - Smart Garbage Sorting AI

This model classifies waste images into one of six recyclable or non-recyclable categories:

- ♻️ Cardboard  
- 🧴 Plastic  
- πŸ“° Paper  
- πŸͺ™ Metal  
- 🍾 Glass  
- πŸ—‘ Trash (non-recyclable)

---

## πŸš€ Try It Live

Upload an image of trash and the model will predict which category it belongs to.

---

## πŸ“‘ API Usage

Call this model programmatically using its REST API:

### πŸ” Python Example (`requests`):

```python
import requests

api_url = "https://yasir-13001-trash-classifier.hf.space/run/predict"
image_path = "example.jpg"

with open(image_path, "rb") as f:
    files = {"image": f}
    response = requests.post(api_url, files=files)

print(response.json())
````

---

### πŸ“¦ Input

* JPG or PNG image file

### 🧾 Output

A dictionary of class names and confidence scores, e.g.:

```json
{
  "paper": 0.85,
  "plastic": 0.03,
  "trash": 0.02,
  ...
}
```

---

## πŸ›  Built With

* PyTorch
* TorchVision
* Gradio
* Hugging Face Spaces

---

## πŸ“š References

* [Hugging Face Spaces Documentation](https://huggingface.co/docs/hub/spaces)
* [Gradio Documentation](https://www.gradio.app/docs)
* [PyTorch Documentation](https://pytorch.org/docs)

---

## πŸ‘¨β€πŸ’» Author

Made with ❀️ by [Yasir](https://huggingface.co/yasir-13001)