Spaces:
Running
on
Zero
Running
on
Zero
Delete breed_detection.py
Browse files- breed_detection.py +0 -38
breed_detection.py
DELETED
@@ -1,38 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
from PIL import Image
|
3 |
-
|
4 |
-
def create_detection_tab(predict_fn, example_images):
|
5 |
-
"""创建品种识别标签页
|
6 |
-
|
7 |
-
Args:
|
8 |
-
predict_fn: 预测函数
|
9 |
-
example_images: 示例图片路径列表
|
10 |
-
"""
|
11 |
-
with gr.TabItem("Breed Detection"):
|
12 |
-
gr.HTML("<p style='text-align: center;'>Upload a picture of a dog, and the model will predict its breed and provide detailed information!</p>")
|
13 |
-
gr.HTML("<p style='text-align: center; color: #666; font-size: 0.9em;'>Note: The model's predictions may not always be 100% accurate, and it is recommended to use the results as a reference.</p>")
|
14 |
-
|
15 |
-
with gr.Row():
|
16 |
-
input_image = gr.Image(label="Upload a dog image", type="pil")
|
17 |
-
output_image = gr.Image(label="Annotated Image")
|
18 |
-
|
19 |
-
output = gr.HTML(label="Prediction Results")
|
20 |
-
initial_state = gr.State()
|
21 |
-
|
22 |
-
input_image.change(
|
23 |
-
predict_fn,
|
24 |
-
inputs=input_image,
|
25 |
-
outputs=[output, output_image, initial_state]
|
26 |
-
)
|
27 |
-
|
28 |
-
gr.Examples(
|
29 |
-
examples=example_images,
|
30 |
-
inputs=input_image
|
31 |
-
)
|
32 |
-
|
33 |
-
return {
|
34 |
-
'input_image': input_image,
|
35 |
-
'output_image': output_image,
|
36 |
-
'output': output,
|
37 |
-
'initial_state': initial_state
|
38 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|