haxerwddle commited on
Commit
f9d1a87
·
1 Parent(s): 94611b0
Files changed (1) hide show
  1. app.py +2 -11
app.py CHANGED
@@ -32,17 +32,8 @@ def preprocess(image):
32
  def predict(img):
33
  img = preprocess(img)
34
  preds = model.predict(img)[0]
35
- cn = ""
36
- if class_names[0] in ["apples", "bananas", "eggshells", "generalcompost", "peels"]:
37
- cn = "Food Waste"
38
- elif class_names[0] in ["bottles", "cans", "platicbags", "plastics"]:
39
- cn = "Plastic Waste"
40
- elif class_names[0] in ["tissue papers", "cardboard"]:
41
- cn = "Paper waste"
42
- else:
43
- cn = "Others"
44
-
45
- return {cn: float(preds[0])}
46
 
47
  demo = gr.Interface(
48
  fn=predict,
 
32
  def predict(img):
33
  img = preprocess(img)
34
  preds = model.predict(img)[0]
35
+
36
+ return {class_names[i]: float(preds[i]) for i in range(len(preds))}
 
 
 
 
 
 
 
 
 
37
 
38
  demo = gr.Interface(
39
  fn=predict,