Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,12 @@ labels = learn.dls.vocab
|
|
7 |
def classify_image(img):
|
8 |
img = PILImage.create(img)
|
9 |
pred, idx, probs = learn.predict(img)
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
image = gr.inputs.Image(shape=(224, 224))
|
13 |
label = gr.outputs.Label()
|
|
|
7 |
def classify_image(img):
|
8 |
img = PILImage.create(img)
|
9 |
pred, idx, probs = learn.predict(img)
|
10 |
+
output = dict(zip(labels, map(float, probs)))
|
11 |
+
for out in output:
|
12 |
+
val = output[out]
|
13 |
+
if val*100 < 60:
|
14 |
+
return {"Not Sure/Others": 0}
|
15 |
+
return output
|
16 |
|
17 |
image = gr.inputs.Image(shape=(224, 224))
|
18 |
label = gr.outputs.Label()
|