Spaces:
Sleeping
Sleeping
Commit ·
94611b0
1
Parent(s): 606f48b
Change
Browse files
app.py
CHANGED
|
@@ -32,7 +32,17 @@ def preprocess(image):
|
|
| 32 |
def predict(img):
|
| 33 |
img = preprocess(img)
|
| 34 |
preds = model.predict(img)[0]
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
demo = gr.Interface(
|
| 38 |
fn=predict,
|
|
|
|
| 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,
|