Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,4 +5,28 @@ description="Gradio Demo for Swin Transformer: Hierarchical Vision Transformer u
|
|
5 |
|
6 |
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2103.14030' target='_blank'>Swin Transformer: Hierarchical Vision Transformer using Shifted Windows</a> | <a href='https://github.com/microsoft/Swin-Transformer' target='_blank'>Github Repo</a></p>"
|
7 |
|
8 |
-
gr.Interface.load("huggingface/microsoft/swin-large-patch4-window12-384-in22k",title=title, article=article,description=description,examples=[["tiger.jpeg"]]).launch(enable_queue=True,cache_examples=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2103.14030' target='_blank'>Swin Transformer: Hierarchical Vision Transformer using Shifted Windows</a> | <a href='https://github.com/microsoft/Swin-Transformer' target='_blank'>Github Repo</a></p>"
|
7 |
|
8 |
+
gr.Interface.load("huggingface/microsoft/swin-large-patch4-window12-384-in22k",title=title, article=article,description=description,examples=[["tiger.jpeg"]]).launch(enable_queue=True,cache_examples=True)
|
9 |
+
|
10 |
+
io1 = gr.Interface.load("huggingface/microsoft/swin-large-patch4-window12-384-in22k")
|
11 |
+
|
12 |
+
io2 = gr.Interface.load("huggingface/microsoft/swin-base-patch4-window7-224-in22k")
|
13 |
+
|
14 |
+
|
15 |
+
def inference(image, model):
|
16 |
+
if model == "swin-large-patch4-window12-384-in22k":
|
17 |
+
outtext = io1(image)
|
18 |
+
else:
|
19 |
+
outtext = io2(image)
|
20 |
+
return outtext
|
21 |
+
|
22 |
+
|
23 |
+
examples=[['tiger.jpeg',"swin-large-patch4-window12-384-in22k"]]
|
24 |
+
gr.Interface(
|
25 |
+
inference,
|
26 |
+
[gr.inputs.Image(label="Input Image"),gr.inputs.Dropdown(choices=["swin-large-patch4-window12-384-in22k","swin-base-patch4-window7-224-in22k"], type="value", default="swin-large-patch4-window12-384-in22k", label="model")
|
27 |
+
],
|
28 |
+
gr.outputs.Label(label="Classification"),
|
29 |
+
examples=examples,
|
30 |
+
article=article,
|
31 |
+
title=title,
|
32 |
+
description=description).launch(enable_queue=True, cache_examples=True)
|