mirror of
https://github.com/THU-MIG/yolov10.git
synced 2025-05-23 21:44:22 +08:00
fix gr.Examples output type mismatch by adding separate function for examples
This commit is contained in:
parent
f87b08feee
commit
34af6d27fa
10
app.py
10
app.py
@ -1,4 +1,4 @@
|
|||||||
# Ackownledgement: https://huggingface.co/spaces/kadirnar/Yolov10/blob/main/app.py
|
# Acknowledgement: https://huggingface.co/spaces/kadirnar/Yolov10/blob/main/app.py
|
||||||
# Thanks to @kadirnar
|
# Thanks to @kadirnar
|
||||||
|
|
||||||
import gradio as gr
|
import gradio as gr
|
||||||
@ -41,6 +41,10 @@ def yolov10_inference_video(video, model_path, image_size, conf_threshold):
|
|||||||
|
|
||||||
return None, output_video_path
|
return None, output_video_path
|
||||||
|
|
||||||
|
def yolov10_inference_for_examples(image, model_path, image_size, conf_threshold):
|
||||||
|
annotated_image, _ = yolov10_inference(image, model_path, image_size, conf_threshold)
|
||||||
|
return annotated_image
|
||||||
|
|
||||||
def app():
|
def app():
|
||||||
with gr.Blocks():
|
with gr.Blocks():
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
@ -126,7 +130,7 @@ def app():
|
|||||||
0.25,
|
0.25,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
fn=yolov10_inference,
|
fn=yolov10_inference_for_examples,
|
||||||
inputs=[
|
inputs=[
|
||||||
image,
|
image,
|
||||||
model_id,
|
model_id,
|
||||||
@ -149,4 +153,4 @@ with gradio_app:
|
|||||||
with gr.Column():
|
with gr.Column():
|
||||||
app()
|
app()
|
||||||
|
|
||||||
gradio_app.launch(debug=True)
|
gradio_app.launch(debug=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user