vu0018 commited on
Commit
c7e9677
·
verified ·
1 Parent(s): 5473ac8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -6,8 +6,8 @@ clf = pipeline("image-classification", model="nateraw/food") # example model
6
 
7
  def predict(img):
8
  preds = clf(img) # list of {label, score}
9
- # return top 3 in format expected by gr.Label
10
- return {p["label"]: float(p["score"]) for p in preds[:3]}
11
 
12
  demo = gr.Interface(fn=predict,
13
  inputs=gr.Image(type="pil"),
 
6
 
7
  def predict(img):
8
  preds = clf(img) # list of {label, score}
9
+ # return top 10 in format expected by gr.Label
10
+ return {p["label"]: float(p["score"]) for p in preds[:10]}
11
 
12
  demo = gr.Interface(fn=predict,
13
  inputs=gr.Image(type="pil"),