ronig commited on
Commit
2c764d8
·
1 Parent(s): a1cee1f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -1,11 +1,15 @@
1
  import gradio as gr
2
  from seefood_classifier_import import get_seefood_classifier
 
 
3
 
4
  classifier = get_seefood_classifier()
5
 
6
  def classify(image):
7
- print(image)
8
- return {str(image): 0.9, 'label2': 0.2}
 
 
9
 
10
  iface = gr.Interface(fn=classify, inputs="image", outputs="label")
11
  iface.launch()
 
1
  import gradio as gr
2
  from seefood_classifier_import import get_seefood_classifier
3
+ import PIL.Image
4
+ import numpy as np
5
 
6
  classifier = get_seefood_classifier()
7
 
8
  def classify(image):
9
+ im = PIL.Image.fromarray(np.array(image, dtype=np.uint8))
10
+ preds = classifier.predict_image(im)
11
+ results = {pred['label']: pred['score'] for pred in preds}
12
+ return results
13
 
14
  iface = gr.Interface(fn=classify, inputs="image", outputs="label")
15
  iface.launch()