Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -67,20 +67,30 @@ def infer(filename: str):
|
|
67 |
|
68 |
|
69 |
if __name__ == "__main__":
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
|
86 |
-
iface.launch()
|
|
|
67 |
|
68 |
|
69 |
if __name__ == "__main__":
|
70 |
+
with gr.Blocks() as demo:
|
71 |
+
gr.Interface(
|
72 |
+
fn=infer,
|
73 |
+
inputs=gr.Image(
|
74 |
+
label="上传昆虫照片 Upload insect picture", type="filepath"
|
75 |
+
),
|
76 |
+
outputs=[
|
77 |
+
gr.Image(label="识别结果 Recognition result"),
|
78 |
+
gr.Textbox(label="最可能的物种 Best match", show_copy_button=True),
|
79 |
+
],
|
80 |
+
title="图像文件格式支持 PNG, JPG, JPEG 和 BMP, 且文件大小不超过 10M<br>Image file format support PNG, JPG, JPEG and BMP, and the file size does not exceed 10M.",
|
81 |
+
examples=[
|
82 |
+
f"{MODEL_DIR}/examples/butterfly.jpg",
|
83 |
+
f"{MODEL_DIR}/examples/beetle.jpg",
|
84 |
+
],
|
85 |
+
allow_flagging="never",
|
86 |
+
cache_examples=False,
|
87 |
+
)
|
88 |
+
|
89 |
+
gr.HTML(
|
90 |
+
"""
|
91 |
+
<iframe src="//player.bilibili.com/player.html?bvid=BV14krgYJE4B&autoplay=0" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" width="100%" style="aspect-ratio: 16 / 9;"></iframe>
|
92 |
+
"""
|
93 |
+
)
|
94 |
+
|
95 |
+
demo.launch()
|
96 |
|
|