Spaces:
Sleeping
Sleeping
gradio
Browse files



app.py
CHANGED
|
@@ -1,11 +1,11 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
#
|
| 4 |
compostable = ["vegetable", "fruit", "food", "leaves"]
|
| 5 |
recyclable = ["plastic", "paper", "glass", "metal", "bottle", "can"]
|
| 6 |
harmful = ["syringe", "battery", "medical", "chemical"]
|
| 7 |
|
| 8 |
-
#
|
| 9 |
bin_images = {
|
| 10 |
"Compostable": "stock-vector-bin-recycle-plastic-green-wheelie-bin-for-waste-isolated-on-white-background-green-bin-with-1306559440.jpg",
|
| 11 |
"Recyclable": "blue-recycling-bin-with-recycle-symbol-for-waste-management-and-sustainability-png.png",
|
|
@@ -21,7 +21,8 @@ def classify_waste(item):
|
|
| 21 |
elif item in harmful:
|
| 22 |
return "⚠️ Harmful/Non-Decomposable Waste", bin_images["Harmful"]
|
| 23 |
else:
|
| 24 |
-
|
|
|
|
| 25 |
|
| 26 |
# Gradio UI
|
| 27 |
iface = gr.Interface(
|
|
@@ -34,3 +35,4 @@ iface = gr.Interface(
|
|
| 34 |
|
| 35 |
if __name__ == "__main__":
|
| 36 |
iface.launch()
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
# Categories
|
| 4 |
compostable = ["vegetable", "fruit", "food", "leaves"]
|
| 5 |
recyclable = ["plastic", "paper", "glass", "metal", "bottle", "can"]
|
| 6 |
harmful = ["syringe", "battery", "medical", "chemical"]
|
| 7 |
|
| 8 |
+
# Bin images
|
| 9 |
bin_images = {
|
| 10 |
"Compostable": "stock-vector-bin-recycle-plastic-green-wheelie-bin-for-waste-isolated-on-white-background-green-bin-with-1306559440.jpg",
|
| 11 |
"Recyclable": "blue-recycling-bin-with-recycle-symbol-for-waste-management-and-sustainability-png.png",
|
|
|
|
| 21 |
elif item in harmful:
|
| 22 |
return "⚠️ Harmful/Non-Decomposable Waste", bin_images["Harmful"]
|
| 23 |
else:
|
| 24 |
+
# Anything unknown defaults to Compostable
|
| 25 |
+
return "✅ Compostable Waste", bin_images["Compostable"]
|
| 26 |
|
| 27 |
# Gradio UI
|
| 28 |
iface = gr.Interface(
|
|
|
|
| 35 |
|
| 36 |
if __name__ == "__main__":
|
| 37 |
iface.launch()
|
| 38 |
+
|