Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from yolo import YOLO | |
| yolo = YOLO() | |
| def predict(image): | |
| r_image = yolo.detect_image(image) | |
| return r_image | |
| title = "MASFNet: Multi-scale Adaptive Sampling Fusion Network for Object Detection in Adverse Weather " | |
| description = "" | |
| article = "" | |
| def reset_interface(): | |
| return gr.update(value=None), gr.update(visible=False) | |
| example_images = [ | |
| "img/1.png", | |
| "img/2.png", | |
| "img/3.png", | |
| "img/4.png", | |
| "img/5.png", | |
| "img/6.png", | |
| "img/7.png", | |
| ] | |
| with gr.Blocks() as demo: | |
| gr.Markdown(f"### {title}") | |
| gr.Markdown(description) | |
| with gr.Row(): | |
| with gr.Column(): | |
| img_input = gr.Image(type="pil", label="Upload an Image") | |
| submit_btn = gr.Button("Submit") | |
| with gr.Column(): | |
| output = gr.Image(type="pil", label="Prediction Result") | |
| submit_btn.click(fn=predict, inputs=img_input, outputs=output) | |
| demo.load(reset_interface, None, [output]) | |
| gr.Examples( | |
| examples=example_images, | |
| inputs=img_input, | |
| ) | |
| demo.launch() | |