Andy1621 commited on
Commit
2152207
·
1 Parent(s): ffe2dca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -54,10 +54,11 @@ def inference(img):
54
  # for name, prob in zip(pred_class_names, pred_class_probs):
55
  # res += f"[{prob:2.2f}%]\t{name}\n"
56
 
57
- return {imagenet_id_to_classname[str(i)]: float(prediction[i]) for i in range(1000)}
58
 
59
  inputs = gr.inputs.Image(type='pil')
60
- outputs = gr.outputs.Textbox(label="Output")
 
61
 
62
  title = "UniFormer-S"
63
 
@@ -66,4 +67,4 @@ description = "Gradio demo for UniFormer: To use it, simply upload your image, o
66
  article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2201.09450' target='_blank'>UniFormer: Unifying Convolution and Self-attention for Visual Recognition</a> | <a href='https://github.com/Sense-X/UniFormer' target='_blank'>Github Repo</a></p>"
67
 
68
 
69
- gr.Interface(inference, inputs, outputs, title=title, description=description, article=article, examples=[['library.jpg']]).launch(enable_queue=True,cache_examples=True)
 
54
  # for name, prob in zip(pred_class_names, pred_class_probs):
55
  # res += f"[{prob:2.2f}%]\t{name}\n"
56
 
57
+ return {imagenet_id_to_classname[str(i.item())]: float(prediction[i]) for i in range(1000)}
58
 
59
  inputs = gr.inputs.Image(type='pil')
60
+ # outputs = gr.outputs.Textbox(label="Output")
61
+ label = gr.outputs.Label(num_top_classes=5)
62
 
63
  title = "UniFormer-S"
64
 
 
67
  article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2201.09450' target='_blank'>UniFormer: Unifying Convolution and Self-attention for Visual Recognition</a> | <a href='https://github.com/Sense-X/UniFormer' target='_blank'>Github Repo</a></p>"
68
 
69
 
70
+ gr.Interface(inference, inputs, outputs=label, title=title, description=description, article=article, examples=[['library.jpg']]).launch(enable_queue=True,cache_examples=True)