Spaces:
Running
Running
MuGeminorum
commited on
Commit
β’
58e5f22
1
Parent(s):
500d4dd
rename example dir
Browse files- app.py +12 -7
- {images β examples}/03.png +0 -0
- {images β examples}/2003.png +0 -0
- {images β examples}/457.png +0 -0
app.py
CHANGED
@@ -81,25 +81,30 @@ def _infer(path_to_checkpoint_file, path_to_input_image):
|
|
81 |
|
82 |
|
83 |
def inference(image_path, weight_path="model-122000.pth"):
|
84 |
-
|
|
|
|
|
|
|
|
|
|
|
85 |
|
86 |
if not image_path:
|
87 |
-
image_path = './
|
88 |
|
89 |
return _infer(weight_path, image_path)
|
90 |
|
91 |
|
92 |
if __name__ == '__main__':
|
93 |
example_images = [
|
94 |
-
'./
|
95 |
-
'./
|
96 |
-
'./
|
97 |
]
|
98 |
|
99 |
iface = gr.Interface(
|
100 |
fn=inference,
|
101 |
-
inputs=gr.Image(type='filepath'),
|
102 |
-
outputs=gr.Textbox(),
|
103 |
examples=example_images
|
104 |
)
|
105 |
|
|
|
81 |
|
82 |
|
83 |
def inference(image_path, weight_path="model-122000.pth"):
|
84 |
+
try:
|
85 |
+
download_model()
|
86 |
+
except Exception:
|
87 |
+
download_model(
|
88 |
+
url="https://www.modelscope.cn/api/v1/models/MuGeminorum/SVHN-Recognition/repo?Revision=master&FilePath=model-122000.pth"
|
89 |
+
)
|
90 |
|
91 |
if not image_path:
|
92 |
+
image_path = './examples/03.png'
|
93 |
|
94 |
return _infer(weight_path, image_path)
|
95 |
|
96 |
|
97 |
if __name__ == '__main__':
|
98 |
example_images = [
|
99 |
+
'./examples/03.png',
|
100 |
+
'./examples/457.png',
|
101 |
+
'./examples/2003.png'
|
102 |
]
|
103 |
|
104 |
iface = gr.Interface(
|
105 |
fn=inference,
|
106 |
+
inputs=gr.Image(type='filepath', label='Upload photo'),
|
107 |
+
outputs=gr.Textbox(label='Recognition result'),
|
108 |
examples=example_images
|
109 |
)
|
110 |
|
{images β examples}/03.png
RENAMED
File without changes
|
{images β examples}/2003.png
RENAMED
File without changes
|
{images β examples}/457.png
RENAMED
File without changes
|