Spaces:
Sleeping
Sleeping
Update Readme
Browse files
README.md
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
---
|
| 2 |
title: Trash Classifier
|
| 3 |
emoji: π
|
|
@@ -11,4 +12,82 @@ license: mit
|
|
| 11 |
short_description: Classify trash into 6 Categories with 90 percent accuracy
|
| 12 |
---
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
---
|
| 3 |
title: Trash Classifier
|
| 4 |
emoji: π
|
|
|
|
| 12 |
short_description: Classify trash into 6 Categories with 90 percent accuracy
|
| 13 |
---
|
| 14 |
|
| 15 |
+
# π§ Trash Classifier - Smart Garbage Sorting AI
|
| 16 |
+
|
| 17 |
+
This model classifies waste images into one of six recyclable or non-recyclable categories:
|
| 18 |
+
|
| 19 |
+
- β»οΈ Cardboard
|
| 20 |
+
- π§΄ Plastic
|
| 21 |
+
- π° Paper
|
| 22 |
+
- πͺ Metal
|
| 23 |
+
- πΎ Glass
|
| 24 |
+
- π Trash (non-recyclable)
|
| 25 |
+
|
| 26 |
+
---
|
| 27 |
+
|
| 28 |
+
## π Try It Live
|
| 29 |
+
|
| 30 |
+
Upload an image of trash and the model will predict which category it belongs to.
|
| 31 |
+
|
| 32 |
+
---
|
| 33 |
+
|
| 34 |
+
## π‘ API Usage
|
| 35 |
+
|
| 36 |
+
Call this model programmatically using its REST API:
|
| 37 |
+
|
| 38 |
+
### π Python Example (`requests`):
|
| 39 |
+
|
| 40 |
+
```python
|
| 41 |
+
import requests
|
| 42 |
+
|
| 43 |
+
api_url = "https://yasir-13001-trash-classifier.hf.space/run/predict"
|
| 44 |
+
image_path = "example.jpg"
|
| 45 |
+
|
| 46 |
+
with open(image_path, "rb") as f:
|
| 47 |
+
files = {"image": f}
|
| 48 |
+
response = requests.post(api_url, files=files)
|
| 49 |
+
|
| 50 |
+
print(response.json())
|
| 51 |
+
````
|
| 52 |
+
|
| 53 |
+
---
|
| 54 |
+
|
| 55 |
+
### π¦ Input
|
| 56 |
+
|
| 57 |
+
* JPG or PNG image file
|
| 58 |
+
|
| 59 |
+
### π§Ύ Output
|
| 60 |
+
|
| 61 |
+
A dictionary of class names and confidence scores, e.g.:
|
| 62 |
+
|
| 63 |
+
```json
|
| 64 |
+
{
|
| 65 |
+
"paper": 0.85,
|
| 66 |
+
"plastic": 0.03,
|
| 67 |
+
"trash": 0.02,
|
| 68 |
+
...
|
| 69 |
+
}
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
---
|
| 73 |
+
|
| 74 |
+
## π Built With
|
| 75 |
+
|
| 76 |
+
* PyTorch
|
| 77 |
+
* TorchVision
|
| 78 |
+
* Gradio
|
| 79 |
+
* Hugging Face Spaces
|
| 80 |
+
|
| 81 |
+
---
|
| 82 |
+
|
| 83 |
+
## π References
|
| 84 |
+
|
| 85 |
+
* [Hugging Face Spaces Documentation](https://huggingface.co/docs/hub/spaces)
|
| 86 |
+
* [Gradio Documentation](https://www.gradio.app/docs)
|
| 87 |
+
* [PyTorch Documentation](https://pytorch.org/docs)
|
| 88 |
+
|
| 89 |
+
---
|
| 90 |
+
|
| 91 |
+
## π¨βπ» Author
|
| 92 |
+
|
| 93 |
+
Made with β€οΈ by [Yasir](https://huggingface.co/yasir-13001)
|