gri11 commited on
Commit
fee9141
1 Parent(s): bf82b0a

Update app.py

Browse files

if no in dict -> 0

Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -16,7 +16,7 @@ def greet(name):
16
  def classify_image(img):
17
  pred, idx, probs = learn.predict(img)
18
  return {
19
- price: str(prices[pred]) + ' baht (' + pred + ")",
20
  label: dict(zip(learn.dls.vocab, map(float, probs))),
21
  }
22
 
 
16
  def classify_image(img):
17
  pred, idx, probs = learn.predict(img)
18
  return {
19
+ price: str(prices[pred] if pred in prices else 0) + ' baht (' + pred + ")",
20
  label: dict(zip(learn.dls.vocab, map(float, probs))),
21
  }
22