NikiTricky commited on
Commit
04864f5
·
1 Parent(s): 34ba7da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -5,13 +5,14 @@ model = from_pretrained_keras("NikiTricky/resnet50-food101")
5
 
6
  def classify_image(inp):
7
  print("Classifying image...")
 
8
  inp = inp.reshape((-1, 224, 224, 3))
9
  inp = inp/255
10
  prediction = model.predict(inp)[0]
11
- print(prediction, model.config)
12
  confidences = {model.config['id2label'][str(i)]: float(prediction[i]) for i in range(101)}
13
  return confidences
14
 
15
  gr.Interface(fn=classify_image,
16
  inputs=gr.Image(shape=(224, 224)),
17
- outputs=gr.Label(num_top_classes=3)).launch()
 
5
 
6
  def classify_image(inp):
7
  print("Classifying image...")
8
+
9
  inp = inp.reshape((-1, 224, 224, 3))
10
  inp = inp/255
11
  prediction = model.predict(inp)[0]
12
+
13
  confidences = {model.config['id2label'][str(i)]: float(prediction[i]) for i in range(101)}
14
  return confidences
15
 
16
  gr.Interface(fn=classify_image,
17
  inputs=gr.Image(shape=(224, 224)),
18
+ outputs=gr.Label(num_top_classes=5)).launch()