vlithish commited on
Commit
d0770f2
·
verified ·
1 Parent(s): 189441e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -1,12 +1,11 @@
1
  import gradio as gr
2
- import os
3
 
4
  # Categories
5
  compostable = ["vegetable", "fruit", "food", "leaves"]
6
  recyclable = ["plastic", "paper", "glass", "metal", "bottle", "can"]
7
  harmful = ["syringe", "battery", "medical", "chemical"]
8
 
9
- # Bin images stored in 'bins/' folder
10
  bin_images = {
11
  "Compostable": "bins/stock-vector-bin-recycle-plastic-green-wheelie-bin-for-waste-isolated-on-white-background-green-bin-with-1306559440.jpg",
12
  "Recyclable": "bins/blue-recycling-bin-with-recycle-symbol-for-waste-management-and-sustainability-png.png",
@@ -22,14 +21,13 @@ def classify_waste(item):
22
  elif item in harmful:
23
  return "⚠️ Harmful/Non-Decomposable Waste", bin_images["Harmful"]
24
  else:
25
- # Unknown items treated as compostable
26
  return "✅ Compostable Waste", bin_images["Compostable"]
27
 
28
- # Gradio UI
29
  iface = gr.Interface(
30
  fn=classify_waste,
31
  inputs="text",
32
- outputs=["text", gr.Image(type="auto")], # Make sure output type is an image
33
  title="♻️ Eco-Friendly Waste Classifier",
34
  description="Enter a waste item (e.g., vegetable, plastic, syringe) and see which bin it belongs to!"
35
  )
@@ -38,3 +36,4 @@ if __name__ == "__main__":
38
  iface.launch()
39
 
40
 
 
 
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 in 'bins/' folder
9
  bin_images = {
10
  "Compostable": "bins/stock-vector-bin-recycle-plastic-green-wheelie-bin-for-waste-isolated-on-white-background-green-bin-with-1306559440.jpg",
11
  "Recyclable": "bins/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
+ # Unknown items treated as Compostable
25
  return "✅ Compostable Waste", bin_images["Compostable"]
26
 
 
27
  iface = gr.Interface(
28
  fn=classify_waste,
29
  inputs="text",
30
+ outputs=["text", gr.Image(type="filepath")], # <-- FIXED here
31
  title="♻️ Eco-Friendly Waste Classifier",
32
  description="Enter a waste item (e.g., vegetable, plastic, syringe) and see which bin it belongs to!"
33
  )
 
36
  iface.launch()
37
 
38
 
39
+