tykimos commited on
Commit
2f2d8de
1 Parent(s): 512c8dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -42,10 +42,12 @@ def clf(name):
42
  data[0] = normalized_image_array
43
 
44
  # run the inference
45
- prediction = model.predict(data)
46
- class_index = np.argmax(prediction)
47
 
48
- return label_dict[class_index]
49
 
50
- iface = gr.Interface(fn=clf, inputs="image", outputs="text")
51
- iface.launch()
 
 
 
42
  data[0] = normalized_image_array
43
 
44
  # run the inference
45
+ prediction = model.predict(data)
46
+ confidences = {label_dict[i]: float(prediction[i]) for i in range(4)}
47
 
48
+ return confidences
49
 
50
+ gr.Interface(fn=predict,
51
+ inputs=gr.Image(type="pil"),
52
+ outputs=gr.Label(num_top_classes=5),
53
+ examples=["12122.jpg", "12342.jpg", "23482.jpg", "23992.jpg", "29349.jpg", "29384.jpg", "32321.jpg", "43413.jpg", "59394.jpg", "77923.jpg", "83823.jpg", "88893.jpg", "88921.jpg", "88923.jpg", "92309.jpg", "92921.jpg"]).launch()