Spaces:
Sleeping
Sleeping
Commit
·
1a11002
1
Parent(s):
20ca536
Fix: interface layout
Browse files
app.py
CHANGED
@@ -81,7 +81,7 @@ def process_image(choice, yolo_versions=["yolov5"]):
|
|
81 |
result_images.append((Image.fromarray(image), f"{yolo_version} not yet implemented."))
|
82 |
return result_images
|
83 |
|
84 |
-
|
85 |
import gradio as gr
|
86 |
with gr.Blocks() as interface:
|
87 |
gr.Markdown("# XAI: Visualize Object Detection of Your Models")
|
@@ -117,4 +117,41 @@ with gr.Blocks() as interface:
|
|
117 |
outputs=result_gallery,
|
118 |
)
|
119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
interface.launch()
|
|
|
81 |
result_images.append((Image.fromarray(image), f"{yolo_version} not yet implemented."))
|
82 |
return result_images
|
83 |
|
84 |
+
"""
|
85 |
import gradio as gr
|
86 |
with gr.Blocks() as interface:
|
87 |
gr.Markdown("# XAI: Visualize Object Detection of Your Models")
|
|
|
117 |
outputs=result_gallery,
|
118 |
)
|
119 |
|
120 |
+
interface.launch()
|
121 |
+
"""
|
122 |
+
with gr.Blocks() as interface:
|
123 |
+
gr.Markdown("# XAI: Visualize Object Detection of Your Models")
|
124 |
+
gr.Markdown("Select a sample image to visualize object detection.")
|
125 |
+
default_sample = "Sample 1"
|
126 |
+
with gr.Row():
|
127 |
+
sample_selection = gr.Radio(
|
128 |
+
choices=list(sample_images.keys()),
|
129 |
+
label="Select a Sample Image",
|
130 |
+
type="value",
|
131 |
+
value=default_sample, # Set default selection
|
132 |
+
)
|
133 |
+
sample_display = gr.Image(
|
134 |
+
value=load_sample_image(default_sample),
|
135 |
+
label="Selected Sample Image",
|
136 |
+
)
|
137 |
+
sample_selection.change(
|
138 |
+
fn=load_sample_image,
|
139 |
+
inputs=sample_selection,
|
140 |
+
outputs=sample_display,
|
141 |
+
)
|
142 |
+
gr.Markdown(" ")
|
143 |
+
|
144 |
+
selected_models = gr.CheckboxGroup(
|
145 |
+
choices=["yolov5", "yolov8s"],
|
146 |
+
value=["yolov5"],
|
147 |
+
label="Select Model(s)",
|
148 |
+
)
|
149 |
+
result_gallery = gr.Gallery(label="Results", elem_id="gallery", rows=2, height=500)
|
150 |
+
|
151 |
+
gr.Button("Run").click(
|
152 |
+
fn=process_image,
|
153 |
+
inputs=[sample_selection, selected_models],
|
154 |
+
outputs=result_gallery,
|
155 |
+
)
|
156 |
+
|
157 |
interface.launch()
|