badaoui HF Staff commited on
Commit
e6fd07c
·
1 Parent(s): 4dbe4aa

some fixes

Browse files
Files changed (2) hide show
  1. app.py +76 -38
  2. styles.css +4 -1
app.py CHANGED
@@ -99,30 +99,6 @@ function refresh() {
99
  window.location.href = url.href;
100
  }
101
  }
102
-
103
- // Handle "Show only failing models" toggle
104
- function setupFailingModelsFilter() {
105
- // Wait for DOM to be ready
106
- setTimeout(() => {
107
- const checkbox = document.querySelector('.failing-models-toggle input[type="checkbox"]');
108
- if (checkbox) {
109
- checkbox.addEventListener('change', (e) => {
110
- const showOnlyFailing = e.target.checked;
111
- const passingModels = document.querySelectorAll('.model-button.no-failures');
112
-
113
- passingModels.forEach(btn => {
114
- if (showOnlyFailing) {
115
- btn.style.display = 'none';
116
- } else {
117
- btn.style.display = 'block';
118
- }
119
- });
120
- });
121
- }
122
- }, 500);
123
- }
124
-
125
- setupFailingModelsFilter();
126
  """
127
 
128
  # Create the Gradio interface with sidebar and dark theme
@@ -175,27 +151,47 @@ with gr.Blocks(title="Model Test Results Dashboard", css=load_css(), js=js_func)
175
  model_buttons = []
176
  model_choices = [model.lower() for model in Ci_results.available_models] if Ci_results.available_models else ["auto", "bert", "clip", "llama"]
177
 
 
 
 
 
178
  print(f"Creating {len(model_choices)} model buttons: {model_choices}")
179
 
180
  for model_name in model_choices:
181
  # Check if model has failures to determine styling
182
  has_failures = model_has_failures(model_name)
183
- button_classes = ["model-button"]
184
  if has_failures:
185
- button_classes.append("model-button-failed")
186
- button_classes.append("has-failures")
187
  else:
188
- button_classes.append("model-button-passing")
189
- button_classes.append("no-failures")
190
-
191
- btn = gr.Button(
192
- model_name,
193
- variant="secondary",
194
- size="sm",
195
- elem_classes=button_classes,
196
- elem_id=f"model-btn-{model_name}"
197
- )
198
- model_buttons.append(btn)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
 
200
  # CI job links at bottom of sidebar
201
  ci_links_display = gr.Markdown("🔗 **CI Jobs:** *Loading...*", elem_classes=["sidebar-links"])
@@ -321,6 +317,22 @@ with gr.Blocks(title="Model Test Results Dashboard", css=load_css(), js=js_func)
321
  elem_classes=["plot-container"]
322
  )
323
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
324
  # Model toggle functionality
325
  def toggle_model_list(current_visible):
326
  """Toggle the visibility of the model list."""
@@ -631,6 +643,7 @@ with gr.Blocks(title="Model Test Results Dashboard", css=load_css(), js=js_func)
631
  gr.update(visible=False), # time_series_detail_view
632
  selected_model, True) # selected_model_state, in_model_view_state
633
 
 
634
  for i, btn in enumerate(model_buttons):
635
  model_name = model_choices[i]
636
  btn.click(
@@ -654,6 +667,31 @@ with gr.Blocks(title="Model Test Results Dashboard", css=load_css(), js=js_func)
654
  in_model_view_state,
655
  ],
656
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
657
 
658
  # Auto-update CI links when the interface loads
659
  demo.load(
 
99
  window.location.href = url.href;
100
  }
101
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  """
103
 
104
  # Create the Gradio interface with sidebar and dark theme
 
151
  model_buttons = []
152
  model_choices = [model.lower() for model in Ci_results.available_models] if Ci_results.available_models else ["auto", "bert", "clip", "llama"]
153
 
154
+ # Separate failing and passing models
155
+ failing_models = []
156
+ passing_models = []
157
+
158
  print(f"Creating {len(model_choices)} model buttons: {model_choices}")
159
 
160
  for model_name in model_choices:
161
  # Check if model has failures to determine styling
162
  has_failures = model_has_failures(model_name)
 
163
  if has_failures:
164
+ failing_models.append(model_name)
 
165
  else:
166
+ passing_models.append(model_name)
167
+
168
+ # Container for all models (visible by default)
169
+ with gr.Column(visible=True, elem_classes=["all-models-container"]) as all_models_container:
170
+ for model_name in model_choices:
171
+ has_failures = model_has_failures(model_name)
172
+ button_classes = ["model-button"]
173
+ if has_failures:
174
+ button_classes.append("model-button-failed")
175
+
176
+ btn = gr.Button(
177
+ model_name,
178
+ variant="secondary",
179
+ size="sm",
180
+ elem_classes=button_classes
181
+ )
182
+ model_buttons.append(btn)
183
+
184
+ # Container for failing models only (hidden by default)
185
+ failing_buttons = []
186
+ with gr.Column(visible=False, elem_classes=["failing-models-container"]) as failing_models_container:
187
+ for model_name in failing_models:
188
+ btn = gr.Button(
189
+ model_name,
190
+ variant="secondary",
191
+ size="sm",
192
+ elem_classes=["model-button", "model-button-failed"]
193
+ )
194
+ failing_buttons.append(btn)
195
 
196
  # CI job links at bottom of sidebar
197
  ci_links_display = gr.Markdown("🔗 **CI Jobs:** *Loading...*", elem_classes=["sidebar-links"])
 
317
  elem_classes=["plot-container"]
318
  )
319
 
320
+ # Failing models toggle functionality
321
+ def toggle_failing_models_filter(show_failing_only):
322
+ """Toggle between showing all models and only failing models."""
323
+ if show_failing_only:
324
+ # Show only failing models container
325
+ return gr.update(visible=False), gr.update(visible=True)
326
+ else:
327
+ # Show all models container
328
+ return gr.update(visible=True), gr.update(visible=False)
329
+
330
+ show_only_failing.change(
331
+ fn=toggle_failing_models_filter,
332
+ inputs=[show_only_failing],
333
+ outputs=[all_models_container, failing_models_container]
334
+ )
335
+
336
  # Model toggle functionality
337
  def toggle_model_list(current_visible):
338
  """Toggle the visibility of the model list."""
 
643
  gr.update(visible=False), # time_series_detail_view
644
  selected_model, True) # selected_model_state, in_model_view_state
645
 
646
+ # Wire up all model buttons
647
  for i, btn in enumerate(model_buttons):
648
  model_name = model_choices[i]
649
  btn.click(
 
667
  in_model_view_state,
668
  ],
669
  )
670
+
671
+ # Wire up failing model buttons (same functionality)
672
+ for i, btn in enumerate(failing_buttons):
673
+ model_name = failing_models[i]
674
+ btn.click(
675
+ fn=lambda history_mode, m=model_name: handle_model_click(m, history_mode),
676
+ inputs=[history_view_button],
677
+ outputs=[
678
+ plot_output,
679
+ amd_failed_tests_output,
680
+ nvidia_failed_tests_output,
681
+ current_view,
682
+ historical_view,
683
+ summary_display,
684
+ detail_view,
685
+ time_series_failure_rates,
686
+ time_series_amd_tests,
687
+ time_series_nvidia_tests,
688
+ time_series_amd_model_plot,
689
+ time_series_nvidia_model_plot,
690
+ time_series_detail_view,
691
+ selected_model_state,
692
+ in_model_view_state,
693
+ ],
694
+ )
695
 
696
  # Auto-update CI links when the interface loads
697
  demo.load(
styles.css CHANGED
@@ -200,7 +200,7 @@ div[data-testid="column"]:has(.sidebar) {
200
  border: 1px solid #333 !important;
201
  border-radius: 6px !important;
202
  padding: 10px 12px !important;
203
- margin: 8px 0px 15px 0px !important;
204
  transition: all 0.3s ease !important;
205
  }
206
 
@@ -217,6 +217,8 @@ div[data-testid="column"]:has(.sidebar) {
217
  text-transform: uppercase !important;
218
  letter-spacing: 0.5px !important;
219
  cursor: pointer !important;
 
 
220
  }
221
 
222
  .failing-models-toggle input[type="checkbox"] {
@@ -224,6 +226,7 @@ div[data-testid="column"]:has(.sidebar) {
224
  cursor: pointer !important;
225
  width: 18px !important;
226
  height: 18px !important;
 
227
  }
228
 
229
  .failing-models-toggle input[type="checkbox"]:checked {
 
200
  border: 1px solid #333 !important;
201
  border-radius: 6px !important;
202
  padding: 10px 12px !important;
203
+ margin: 8px 0px 12px 0px !important;
204
  transition: all 0.3s ease !important;
205
  }
206
 
 
217
  text-transform: uppercase !important;
218
  letter-spacing: 0.5px !important;
219
  cursor: pointer !important;
220
+ display: flex !important;
221
+ align-items: center !important;
222
  }
223
 
224
  .failing-models-toggle input[type="checkbox"] {
 
226
  cursor: pointer !important;
227
  width: 18px !important;
228
  height: 18px !important;
229
+ margin-right: 8px !important;
230
  }
231
 
232
  .failing-models-toggle input[type="checkbox"]:checked {