asquirous commited on
Commit
f64fcc8
·
1 Parent(s): 10714e8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
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
- return dict(zip(labels, map(float, probs)))
 
 
 
 
 
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()