kakamond commited on
Commit
850d541
·
verified ·
1 Parent(s): b4c5407

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -16
app.py CHANGED
@@ -67,20 +67,30 @@ def infer(filename: str):
67
 
68
 
69
  if __name__ == "__main__":
70
- iface = gr.Interface(
71
- fn=infer,
72
- inputs=gr.Image(label="上传昆虫照片 Upload insect picture", type="filepath"),
73
- outputs=[
74
- gr.Image(label="识别结果 Recognition result"),
75
- gr.Textbox(label="最可能的物种 Best match", show_copy_button=True),
76
- ],
77
- title="图像文件格式支持 PNG, JPG, JPEG 和 BMP, 且文件大小不超过 10M<br>Image file format support PNG, JPG, JPEG and BMP, and the file size does not exceed 10M.",
78
- examples=[
79
- f"{MODEL_DIR}/examples/butterfly.jpg",
80
- f"{MODEL_DIR}/examples/beetle.jpg",
81
- ],
82
- allow_flagging="never",
83
- cache_examples=False,
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