haxerwddle commited on
Commit
47abb3e
·
1 Parent(s): b672110

Model prompt change

Browse files
Files changed (1) hide show
  1. app.py +41 -1
app.py CHANGED
@@ -87,6 +87,44 @@ def explain_recycling(class_label):
87
 
88
  # ------------------ PIPELINE ------------------
89
  top_label = None
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
 
91
  def classify_pipeline(image):
92
  global top_label
@@ -100,8 +138,10 @@ def analyze_pipeline():
100
 
101
  if top_label is None:
102
  return "Please classify an image first."
 
103
  explanation = explain_recycling(top_label)
104
- return explanation
 
105
 
106
 
107
  # ------------------ GRADIO UI ------------------
 
87
 
88
  # ------------------ PIPELINE ------------------
89
  top_label = None
90
+ waste_analization = {
91
+ "cardboard": {
92
+ "Recycling type": "Paper/Cardboard recycling\n",
93
+ "Disposal": "Flatten the cardboard boxes and remove any non-paper packing materials before placing them in the recycling bin.\n",
94
+ "Tips": "Keep cardboard dry and clean to ensure it can be recycled efficiently.\n",
95
+ "Extra": "Avoid using waxed or heavily coated cardboard, as it may not be recyclable.\n"
96
+ },
97
+ "glass": {
98
+ "Recycling type": "Glass recycling\n",
99
+ "Disposal": "Rinse glass bottles and jars, remove lids, and place them in a dedicated glass recycling container.\n",
100
+ "Tips": "Avoid breaking the glass; broken pieces can be hazardous and may complicate processing.\n",
101
+ "Extra": "Colored glass is often recycled separately; check local recycling rules.\n"
102
+ },
103
+ "metal": {
104
+ "Recycling type": "Metal recycling\n",
105
+ "Disposal": "Rinse aluminum cans and steel containers, remove labels if possible, and put them in the metal recycling bin.\n",
106
+ "Tips": "Crush cans to save space and facilitate transport.\n",
107
+ "Extra": "Avoid contaminating with food waste to improve recycling efficiency.\n"
108
+ },
109
+ "paper": {
110
+ "Recycling type": "Paper recycling\n",
111
+ "Disposal": "Sort newspapers, office paper, and magazines into the paper recycling bin; remove plastic coatings and staples.\n",
112
+ "Tips": "Shred sensitive documents but keep shredded paper in a bag to avoid scattering.\n",
113
+ "Extra": "Do not recycle wet or food-stained paper.\n"
114
+ },
115
+ "plastic": {
116
+ "Recycling type": "Plastic recycling\n",
117
+ "Disposal": "Rinse plastic bottles, containers, and packaging, and place them in the plastic recycling bin.\n",
118
+ "Tips": "Check recycling codes; some plastics (like #3 PVC) are not widely recyclable.\n",
119
+ "Extra": "Remove caps and labels when possible to improve sorting efficiency.\n"
120
+ },
121
+ "trash": {
122
+ "Recycling type": "General waste / landfill\n",
123
+ "Disposal": "Place non-recyclable items in the regular trash bin; avoid mixing with recyclables.\n",
124
+ "Tips": "Separate hazardous materials like batteries, electronics, or chemicals for special disposal.\n",
125
+ "Extra": "Try to reduce overall waste by reusing and composting when possible.\n"
126
+ }
127
+ }
128
 
129
  def classify_pipeline(image):
130
  global top_label
 
138
 
139
  if top_label is None:
140
  return "Please classify an image first."
141
+
142
  explanation = explain_recycling(top_label)
143
+
144
+ return waste_analization[top_label]
145
 
146
 
147
  # ------------------ GRADIO UI ------------------