Spaces:
Sleeping
Sleeping
Commit
·
5325ebe
1
Parent(s):
8134c9f
Update: font styling
Browse files
app.py
CHANGED
@@ -7,7 +7,6 @@ import gradio as gr
|
|
7 |
from yolov5 import xai_yolov5
|
8 |
from yolov8 import xai_yolov8s
|
9 |
|
10 |
-
|
11 |
sample_images = {
|
12 |
"Sample 1": os.path.join(os.getcwd(), "data/xai/sample1.jpeg"),
|
13 |
"Sample 2": os.path.join(os.getcwd(), "data/xai/sample2.jpg"),
|
@@ -48,9 +47,8 @@ def process_image(sample_choice, uploaded_image, yolo_versions=["yolov5"]):
|
|
48 |
return result_images
|
49 |
|
50 |
with gr.Blocks() as interface:
|
51 |
-
gr.Markdown("#
|
52 |
-
|
53 |
-
gr.Markdown(" # <span style='color:white'>Select a sample image to visualize object detection.")
|
54 |
default_sample = "Sample 1"
|
55 |
|
56 |
# Inject CSS with gr.HTML to set the text color to white
|
@@ -60,8 +58,11 @@ with gr.Blocks() as interface:
|
|
60 |
background-color: black;
|
61 |
color: white; /* Set text color to white */
|
62 |
}
|
63 |
-
.gradio-container
|
64 |
-
color: white
|
|
|
|
|
|
|
65 |
}
|
66 |
</style>
|
67 |
""")
|
@@ -76,7 +77,7 @@ with gr.Blocks() as interface:
|
|
76 |
value=default_sample, # Set default selection
|
77 |
)
|
78 |
# Upload image below sample selection
|
79 |
-
gr.Markdown("
|
80 |
upload_image = gr.Image(
|
81 |
label="Upload an Image",
|
82 |
type="pil", # Correct type for file path compatibility
|
@@ -106,5 +107,5 @@ with gr.Blocks() as interface:
|
|
106 |
outputs=result_gallery,
|
107 |
)
|
108 |
|
109 |
-
# Launch the interface without the css argument
|
110 |
-
interface.launch(share=True)
|
|
|
7 |
from yolov5 import xai_yolov5
|
8 |
from yolov8 import xai_yolov8s
|
9 |
|
|
|
10 |
sample_images = {
|
11 |
"Sample 1": os.path.join(os.getcwd(), "data/xai/sample1.jpeg"),
|
12 |
"Sample 2": os.path.join(os.getcwd(), "data/xai/sample2.jpg"),
|
|
|
47 |
return result_images
|
48 |
|
49 |
with gr.Blocks() as interface:
|
50 |
+
gr.Markdown("# XAI: Visualize Object Detection of Your Models")
|
51 |
+
gr.Markdown("Select a sample image to visualize object detection.")
|
|
|
52 |
default_sample = "Sample 1"
|
53 |
|
54 |
# Inject CSS with gr.HTML to set the text color to white
|
|
|
58 |
background-color: black;
|
59 |
color: white; /* Set text color to white */
|
60 |
}
|
61 |
+
.gradio-container {
|
62 |
+
color: white; /* Ensure Gradio components also have white text */
|
63 |
+
}
|
64 |
+
h1, h2, h3, h4, h5, h6, p, label {
|
65 |
+
color: white; /* Make all headings and labels white */
|
66 |
}
|
67 |
</style>
|
68 |
""")
|
|
|
77 |
value=default_sample, # Set default selection
|
78 |
)
|
79 |
# Upload image below sample selection
|
80 |
+
gr.Markdown("**Or upload your own image:**")
|
81 |
upload_image = gr.Image(
|
82 |
label="Upload an Image",
|
83 |
type="pil", # Correct type for file path compatibility
|
|
|
107 |
outputs=result_gallery,
|
108 |
)
|
109 |
|
110 |
+
# Launch the interface without the `css` argument
|
111 |
+
interface.launch(share=True)
|