Spaces:
Sleeping
Sleeping
Commit
·
b21eb38
1
Parent(s):
e3b086b
Fix: argument mismatch
Browse files
app.py
CHANGED
@@ -22,30 +22,34 @@ def process_image(image, yolo_versions=["yolov5"]):
|
|
22 |
result_images.append((Image.fromarray(image), f"{yolo_version} not yet implemented."))
|
23 |
return result_images
|
24 |
|
|
|
|
|
|
|
|
|
|
|
25 |
|
|
|
26 |
interface = gr.Interface(
|
27 |
fn=process_image,
|
28 |
inputs=[
|
29 |
-
gr.
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
34 |
),
|
35 |
gr.CheckboxGroup(
|
36 |
choices=["yolov5", "yolov8s"],
|
37 |
-
value=["yolov5"], # Default
|
38 |
label="Select Model(s)",
|
39 |
type="value", # Ensure the value is passed as a list of selected models
|
40 |
),
|
41 |
],
|
42 |
outputs=gr.Gallery(label="Results", elem_id="gallery", rows=2, height=500),
|
43 |
title="Explainable AI for YOLO Models",
|
44 |
-
description="
|
45 |
-
examples=
|
46 |
-
[os.path.join(os.getcwd(), "data/xai/sample1.jpeg")],
|
47 |
-
[os.path.join(os.getcwd(), "data/xai/sample2.jpg")],
|
48 |
-
],
|
49 |
live=True,
|
50 |
)
|
51 |
|
|
|
22 |
result_images.append((Image.fromarray(image), f"{yolo_version} not yet implemented."))
|
23 |
return result_images
|
24 |
|
25 |
+
# Paths to sample images
|
26 |
+
sample_images = [
|
27 |
+
os.path.join(os.getcwd(), "data/xai/sample1.jpeg"),
|
28 |
+
os.path.join(os.getcwd(), "data/xai/sample2.jpg")
|
29 |
+
]
|
30 |
|
31 |
+
# Interface definition
|
32 |
interface = gr.Interface(
|
33 |
fn=process_image,
|
34 |
inputs=[
|
35 |
+
gr.Gallery(
|
36 |
+
label="Select Sample Image",
|
37 |
+
value=sample_images[0], # Default value to highlight the first image
|
38 |
+
choices=sample_images, # List of sample images
|
39 |
+
type="pil",
|
40 |
+
interactive=True # Allow user to click and select an image
|
41 |
),
|
42 |
gr.CheckboxGroup(
|
43 |
choices=["yolov5", "yolov8s"],
|
44 |
+
value=["yolov5"], # Default model selected
|
45 |
label="Select Model(s)",
|
46 |
type="value", # Ensure the value is passed as a list of selected models
|
47 |
),
|
48 |
],
|
49 |
outputs=gr.Gallery(label="Results", elem_id="gallery", rows=2, height=500),
|
50 |
title="Explainable AI for YOLO Models",
|
51 |
+
description="Select a sample image and choose a model to visualize YOLO object detection with Grad-CAM.",
|
52 |
+
examples=sample_images, # Example images to display
|
|
|
|
|
|
|
53 |
live=True,
|
54 |
)
|
55 |
|