BhumikaMak commited on
Commit
6eea241
·
1 Parent(s): 51daec3

Update: font styling

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -11,6 +11,7 @@ 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"),
13
  }
 
14
  def load_sample_image(sample_name):
15
  image_path = sample_images.get(sample_name)
16
  if image_path and os.path.exists(image_path):
@@ -26,7 +27,6 @@ def load_sample_image(choice):
26
  else:
27
  raise ValueError("Invalid sample selection.")
28
 
29
-
30
  def process_image(sample_choice, uploaded_image, yolo_versions=["yolov5"]):
31
  print(sample_choice, upload_image)
32
  if uploaded_image is not None:
@@ -47,7 +47,7 @@ def process_image(sample_choice, uploaded_image, yolo_versions=["yolov5"]):
47
  return result_images
48
 
49
  with gr.Blocks() as interface:
50
- # Update CSS to make gr.Markdown text white
51
  gr.HTML("""
52
  <style>
53
  body {
@@ -60,11 +60,19 @@ with gr.Blocks() as interface:
60
  h1, h2, h3, h4, h5, h6, p, label {
61
  color: white; /* Make all headings and labels white */
62
  }
 
 
 
 
 
 
 
63
  </style>
64
  """)
65
 
66
  gr.Markdown("<h1 style='color: white;'>XAI: Visualize Object Detection of Your Models</h1>")
67
  gr.Markdown("<p style='color: white;'>Select a sample image to visualize object detection.</p>")
 
68
  default_sample = "Sample 1"
69
 
70
  with gr.Row(elem_classes="orchid-green-bg"):
@@ -82,6 +90,7 @@ with gr.Blocks() as interface:
82
  label="Upload an Image",
83
  type="pil", # Correct type for file path compatibility
84
  )
 
85
  # Right side: Selected sample image display
86
  sample_display = gr.Image(
87
  value=load_sample_image(default_sample),
@@ -99,6 +108,7 @@ with gr.Blocks() as interface:
99
  value=["yolov5"],
100
  label="Select Model(s)",
101
  )
 
102
  result_gallery = gr.Gallery(label="Results", elem_id="gallery", rows=2, height=500)
103
 
104
  gr.Button("Run").click(
 
11
  "Sample 1": os.path.join(os.getcwd(), "data/xai/sample1.jpeg"),
12
  "Sample 2": os.path.join(os.getcwd(), "data/xai/sample2.jpg"),
13
  }
14
+
15
  def load_sample_image(sample_name):
16
  image_path = sample_images.get(sample_name)
17
  if image_path and os.path.exists(image_path):
 
27
  else:
28
  raise ValueError("Invalid sample selection.")
29
 
 
30
  def process_image(sample_choice, uploaded_image, yolo_versions=["yolov5"]):
31
  print(sample_choice, upload_image)
32
  if uploaded_image is not None:
 
47
  return result_images
48
 
49
  with gr.Blocks() as interface:
50
+ # Update CSS to make text white
51
  gr.HTML("""
52
  <style>
53
  body {
 
60
  h1, h2, h3, h4, h5, h6, p, label {
61
  color: white; /* Make all headings and labels white */
62
  }
63
+ .gr-button {
64
+ background-color: #007bff; /* Optional: Change button background color */
65
+ color: white; /* Ensure button text is white */
66
+ }
67
+ .gr-button:hover {
68
+ background-color: #0056b3; /* Optional: Change button hover color */
69
+ }
70
  </style>
71
  """)
72
 
73
  gr.Markdown("<h1 style='color: white;'>XAI: Visualize Object Detection of Your Models</h1>")
74
  gr.Markdown("<p style='color: white;'>Select a sample image to visualize object detection.</p>")
75
+
76
  default_sample = "Sample 1"
77
 
78
  with gr.Row(elem_classes="orchid-green-bg"):
 
90
  label="Upload an Image",
91
  type="pil", # Correct type for file path compatibility
92
  )
93
+
94
  # Right side: Selected sample image display
95
  sample_display = gr.Image(
96
  value=load_sample_image(default_sample),
 
108
  value=["yolov5"],
109
  label="Select Model(s)",
110
  )
111
+
112
  result_gallery = gr.Gallery(label="Results", elem_id="gallery", rows=2, height=500)
113
 
114
  gr.Button("Run").click(