badaoui HF Staff commited on
Commit
e970e27
·
1 Parent(s): 6d8041f

fix styling

Browse files
Files changed (1) hide show
  1. time_series_gradio.py +106 -37
time_series_gradio.py CHANGED
@@ -134,10 +134,11 @@ def create_time_series_summary_gradio(historical_df: pd.DataFrame) -> dict:
134
  empty_fig = go.Figure()
135
  empty_fig.update_layout(
136
  title="No historical data available",
137
- height=400,
138
  font=dict(size=16, color='#CCCCCC'),
139
  paper_bgcolor='#000000',
140
  plot_bgcolor='#1a1a1a',
 
141
  )
142
  return {
143
  'failure_rates': empty_fig,
@@ -221,27 +222,55 @@ def create_time_series_summary_gradio(historical_df: pd.DataFrame) -> dict:
221
 
222
  nvidia_df = pd.DataFrame(nvidia_data)
223
 
224
- # Create Plotly figure for failure rates
225
- fig_failure_rates = px.line(
226
- failure_rate_df,
227
- x='date',
228
- y='failure_rate',
229
- color='platform',
230
- color_discrete_map={"AMD": COLORS['amd'], "NVIDIA": COLORS['nvidia']},
231
- title="Overall Failure Rates Over Time",
232
- labels={'failure_rate': 'Failure Rate (%)', 'date': 'Date', 'platform': 'Platform'}
233
- )
234
- fig_failure_rates.update_traces(mode='lines+markers', marker=dict(size=8))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
235
  fig_failure_rates.update_layout(
236
- height=400,
 
237
  font=dict(size=16, color='#CCCCCC'),
238
  paper_bgcolor='#000000',
239
  plot_bgcolor='#1a1a1a',
240
  title_font_size=20,
241
- legend=dict(font=dict(size=16), bgcolor='rgba(0,0,0,0.5)', yanchor="top", y=0.99, xanchor="left", x=0.01),
242
- xaxis=dict(title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
243
- yaxis=dict(title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
244
- hovermode='x unified'
 
 
 
 
 
 
 
 
 
245
  )
246
 
247
  # Create Plotly figure for AMD tests
@@ -254,17 +283,26 @@ def create_time_series_summary_gradio(historical_df: pd.DataFrame) -> dict:
254
  title="AMD Test Results Over Time",
255
  labels={'count': 'Number of Tests', 'date': 'Date', 'test_type': 'Test Type'}
256
  )
257
- fig_amd.update_traces(mode='lines+markers', marker=dict(size=8))
258
  fig_amd.update_layout(
259
- height=400,
260
  font=dict(size=16, color='#CCCCCC'),
261
  paper_bgcolor='#000000',
262
  plot_bgcolor='#1a1a1a',
263
  title_font_size=20,
264
- legend=dict(font=dict(size=16), bgcolor='rgba(0,0,0,0.5)', yanchor="top", y=0.99, xanchor="left", x=0.01),
 
 
 
 
 
 
 
 
265
  xaxis=dict(title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
266
  yaxis=dict(title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
267
- hovermode='x unified'
 
268
  )
269
 
270
  # Create Plotly figure for NVIDIA tests
@@ -277,17 +315,26 @@ def create_time_series_summary_gradio(historical_df: pd.DataFrame) -> dict:
277
  title="NVIDIA Test Results Over Time",
278
  labels={'count': 'Number of Tests', 'date': 'Date', 'test_type': 'Test Type'}
279
  )
280
- fig_nvidia.update_traces(mode='lines+markers', marker=dict(size=8))
281
  fig_nvidia.update_layout(
282
- height=400,
283
  font=dict(size=16, color='#CCCCCC'),
284
  paper_bgcolor='#000000',
285
  plot_bgcolor='#1a1a1a',
286
  title_font_size=20,
287
- legend=dict(font=dict(size=16), bgcolor='rgba(0,0,0,0.5)', yanchor="top", y=0.99, xanchor="left", x=0.01),
 
 
 
 
 
 
 
 
288
  xaxis=dict(title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
289
  yaxis=dict(title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
290
- hovermode='x unified'
 
291
  )
292
 
293
  return {
@@ -303,18 +350,20 @@ def create_model_time_series_gradio(historical_df: pd.DataFrame, model_name: str
303
  empty_fig_amd = go.Figure()
304
  empty_fig_amd.update_layout(
305
  title=f"{model_name.upper()} - AMD Results Over Time",
306
- height=400,
307
  font=dict(size=16, color='#CCCCCC'),
308
  paper_bgcolor='#000000',
309
  plot_bgcolor='#1a1a1a',
 
310
  )
311
  empty_fig_nvidia = go.Figure()
312
  empty_fig_nvidia.update_layout(
313
  title=f"{model_name.upper()} - NVIDIA Results Over Time",
314
- height=400,
315
  font=dict(size=16, color='#CCCCCC'),
316
  paper_bgcolor='#000000',
317
  plot_bgcolor='#1a1a1a',
 
318
  )
319
  return {
320
  'amd_plot': empty_fig_amd,
@@ -328,18 +377,20 @@ def create_model_time_series_gradio(historical_df: pd.DataFrame, model_name: str
328
  empty_fig_amd = go.Figure()
329
  empty_fig_amd.update_layout(
330
  title=f"{model_name.upper()} - AMD Results Over Time",
331
- height=400,
332
  font=dict(size=16, color='#CCCCCC'),
333
  paper_bgcolor='#000000',
334
  plot_bgcolor='#1a1a1a',
 
335
  )
336
  empty_fig_nvidia = go.Figure()
337
  empty_fig_nvidia.update_layout(
338
  title=f"{model_name.upper()} - NVIDIA Results Over Time",
339
- height=400,
340
  font=dict(size=16, color='#CCCCCC'),
341
  paper_bgcolor='#000000',
342
  plot_bgcolor='#1a1a1a',
 
343
  )
344
  return {
345
  'amd_plot': empty_fig_amd,
@@ -416,17 +467,26 @@ def create_model_time_series_gradio(historical_df: pd.DataFrame, model_name: str
416
  title=f"{model_name.upper()} - AMD Results Over Time",
417
  labels={'count': 'Number of Tests', 'date': 'Date', 'test_type': 'Test Type'}
418
  )
419
- fig_amd.update_traces(mode='lines+markers', marker=dict(size=8))
420
  fig_amd.update_layout(
421
- height=400,
422
  font=dict(size=16, color='#CCCCCC'),
423
  paper_bgcolor='#000000',
424
  plot_bgcolor='#1a1a1a',
425
  title_font_size=20,
426
- legend=dict(font=dict(size=16), bgcolor='rgba(0,0,0,0.5)', yanchor="top", y=0.99, xanchor="left", x=0.01),
 
 
 
 
 
 
 
 
427
  xaxis=dict(title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
428
  yaxis=dict(title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
429
- hovermode='x unified'
 
430
  )
431
 
432
  # Create Plotly figure for NVIDIA
@@ -439,17 +499,26 @@ def create_model_time_series_gradio(historical_df: pd.DataFrame, model_name: str
439
  title=f"{model_name.upper()} - NVIDIA Results Over Time",
440
  labels={'count': 'Number of Tests', 'date': 'Date', 'test_type': 'Test Type'}
441
  )
442
- fig_nvidia.update_traces(mode='lines+markers', marker=dict(size=8))
443
  fig_nvidia.update_layout(
444
- height=400,
445
  font=dict(size=16, color='#CCCCCC'),
446
  paper_bgcolor='#000000',
447
  plot_bgcolor='#1a1a1a',
448
  title_font_size=20,
449
- legend=dict(font=dict(size=16), bgcolor='rgba(0,0,0,0.5)', yanchor="top", y=0.99, xanchor="left", x=0.01),
 
 
 
 
 
 
 
 
450
  xaxis=dict(title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
451
  yaxis=dict(title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
452
- hovermode='x unified'
 
453
  )
454
 
455
  return {
 
134
  empty_fig = go.Figure()
135
  empty_fig.update_layout(
136
  title="No historical data available",
137
+ height=500,
138
  font=dict(size=16, color='#CCCCCC'),
139
  paper_bgcolor='#000000',
140
  plot_bgcolor='#1a1a1a',
141
+ margin=dict(b=120)
142
  )
143
  return {
144
  'failure_rates': empty_fig,
 
222
 
223
  nvidia_df = pd.DataFrame(nvidia_data)
224
 
225
+ # Create Plotly figure for failure rates with alternating colors
226
+ fig_failure_rates = go.Figure()
227
+
228
+ # Add NVIDIA line (green line with white markers - Barcelona style)
229
+ nvidia_data = failure_rate_df[failure_rate_df['platform'] == 'NVIDIA']
230
+ if not nvidia_data.empty:
231
+ fig_failure_rates.add_trace(go.Scatter(
232
+ x=nvidia_data['date'],
233
+ y=nvidia_data['failure_rate'],
234
+ mode='lines+markers',
235
+ name='NVIDIA',
236
+ line=dict(color='#76B900', width=3), # Green line
237
+ marker=dict(size=12, color='#FFFFFF', line=dict(color='#76B900', width=2)), # White markers with green border
238
+ hovertemplate='<b>NVIDIA</b><br>Date: %{x}<br>Failure Rate: %{y:.2f}%<extra></extra>'
239
+ ))
240
+
241
+ # Add AMD line (red line with gray markers - Barcelona style)
242
+ amd_data = failure_rate_df[failure_rate_df['platform'] == 'AMD']
243
+ if not amd_data.empty:
244
+ fig_failure_rates.add_trace(go.Scatter(
245
+ x=amd_data['date'],
246
+ y=amd_data['failure_rate'],
247
+ mode='lines+markers',
248
+ name='AMD',
249
+ line=dict(color='#ED1C24', width=3), # Red line
250
+ marker=dict(size=12, color='#808080', line=dict(color='#ED1C24', width=2)), # Gray markers with red border
251
+ hovertemplate='<b>AMD</b><br>Date: %{x}<br>Failure Rate: %{y:.2f}%<extra></extra>'
252
+ ))
253
+
254
  fig_failure_rates.update_layout(
255
+ title="Overall Failure Rates Over Time",
256
+ height=500,
257
  font=dict(size=16, color='#CCCCCC'),
258
  paper_bgcolor='#000000',
259
  plot_bgcolor='#1a1a1a',
260
  title_font_size=20,
261
+ legend=dict(
262
+ font=dict(size=16),
263
+ bgcolor='rgba(0,0,0,0.5)',
264
+ orientation="h",
265
+ yanchor="bottom",
266
+ y=-0.3,
267
+ xanchor="center",
268
+ x=0.5
269
+ ),
270
+ xaxis=dict(title='Date', title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
271
+ yaxis=dict(title='Failure Rate (%)', title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
272
+ hovermode='x unified',
273
+ margin=dict(b=120)
274
  )
275
 
276
  # Create Plotly figure for AMD tests
 
283
  title="AMD Test Results Over Time",
284
  labels={'count': 'Number of Tests', 'date': 'Date', 'test_type': 'Test Type'}
285
  )
286
+ fig_amd.update_traces(mode='lines+markers', marker=dict(size=8), line=dict(width=3))
287
  fig_amd.update_layout(
288
+ height=500,
289
  font=dict(size=16, color='#CCCCCC'),
290
  paper_bgcolor='#000000',
291
  plot_bgcolor='#1a1a1a',
292
  title_font_size=20,
293
+ legend=dict(
294
+ font=dict(size=16),
295
+ bgcolor='rgba(0,0,0,0.5)',
296
+ orientation="h",
297
+ yanchor="bottom",
298
+ y=-0.3,
299
+ xanchor="center",
300
+ x=0.5
301
+ ),
302
  xaxis=dict(title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
303
  yaxis=dict(title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
304
+ hovermode='x unified',
305
+ margin=dict(b=120)
306
  )
307
 
308
  # Create Plotly figure for NVIDIA tests
 
315
  title="NVIDIA Test Results Over Time",
316
  labels={'count': 'Number of Tests', 'date': 'Date', 'test_type': 'Test Type'}
317
  )
318
+ fig_nvidia.update_traces(mode='lines+markers', marker=dict(size=8), line=dict(width=3))
319
  fig_nvidia.update_layout(
320
+ height=500,
321
  font=dict(size=16, color='#CCCCCC'),
322
  paper_bgcolor='#000000',
323
  plot_bgcolor='#1a1a1a',
324
  title_font_size=20,
325
+ legend=dict(
326
+ font=dict(size=16),
327
+ bgcolor='rgba(0,0,0,0.5)',
328
+ orientation="h",
329
+ yanchor="bottom",
330
+ y=-0.3,
331
+ xanchor="center",
332
+ x=0.5
333
+ ),
334
  xaxis=dict(title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
335
  yaxis=dict(title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
336
+ hovermode='x unified',
337
+ margin=dict(b=120)
338
  )
339
 
340
  return {
 
350
  empty_fig_amd = go.Figure()
351
  empty_fig_amd.update_layout(
352
  title=f"{model_name.upper()} - AMD Results Over Time",
353
+ height=500,
354
  font=dict(size=16, color='#CCCCCC'),
355
  paper_bgcolor='#000000',
356
  plot_bgcolor='#1a1a1a',
357
+ margin=dict(b=120)
358
  )
359
  empty_fig_nvidia = go.Figure()
360
  empty_fig_nvidia.update_layout(
361
  title=f"{model_name.upper()} - NVIDIA Results Over Time",
362
+ height=500,
363
  font=dict(size=16, color='#CCCCCC'),
364
  paper_bgcolor='#000000',
365
  plot_bgcolor='#1a1a1a',
366
+ margin=dict(b=120)
367
  )
368
  return {
369
  'amd_plot': empty_fig_amd,
 
377
  empty_fig_amd = go.Figure()
378
  empty_fig_amd.update_layout(
379
  title=f"{model_name.upper()} - AMD Results Over Time",
380
+ height=500,
381
  font=dict(size=16, color='#CCCCCC'),
382
  paper_bgcolor='#000000',
383
  plot_bgcolor='#1a1a1a',
384
+ margin=dict(b=120)
385
  )
386
  empty_fig_nvidia = go.Figure()
387
  empty_fig_nvidia.update_layout(
388
  title=f"{model_name.upper()} - NVIDIA Results Over Time",
389
+ height=500,
390
  font=dict(size=16, color='#CCCCCC'),
391
  paper_bgcolor='#000000',
392
  plot_bgcolor='#1a1a1a',
393
+ margin=dict(b=120)
394
  )
395
  return {
396
  'amd_plot': empty_fig_amd,
 
467
  title=f"{model_name.upper()} - AMD Results Over Time",
468
  labels={'count': 'Number of Tests', 'date': 'Date', 'test_type': 'Test Type'}
469
  )
470
+ fig_amd.update_traces(mode='lines+markers', marker=dict(size=8), line=dict(width=3))
471
  fig_amd.update_layout(
472
+ height=500,
473
  font=dict(size=16, color='#CCCCCC'),
474
  paper_bgcolor='#000000',
475
  plot_bgcolor='#1a1a1a',
476
  title_font_size=20,
477
+ legend=dict(
478
+ font=dict(size=16),
479
+ bgcolor='rgba(0,0,0,0.5)',
480
+ orientation="h",
481
+ yanchor="bottom",
482
+ y=-0.3,
483
+ xanchor="center",
484
+ x=0.5
485
+ ),
486
  xaxis=dict(title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
487
  yaxis=dict(title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
488
+ hovermode='x unified',
489
+ margin=dict(b=120)
490
  )
491
 
492
  # Create Plotly figure for NVIDIA
 
499
  title=f"{model_name.upper()} - NVIDIA Results Over Time",
500
  labels={'count': 'Number of Tests', 'date': 'Date', 'test_type': 'Test Type'}
501
  )
502
+ fig_nvidia.update_traces(mode='lines+markers', marker=dict(size=8), line=dict(width=3))
503
  fig_nvidia.update_layout(
504
+ height=500,
505
  font=dict(size=16, color='#CCCCCC'),
506
  paper_bgcolor='#000000',
507
  plot_bgcolor='#1a1a1a',
508
  title_font_size=20,
509
+ legend=dict(
510
+ font=dict(size=16),
511
+ bgcolor='rgba(0,0,0,0.5)',
512
+ orientation="h",
513
+ yanchor="bottom",
514
+ y=-0.3,
515
+ xanchor="center",
516
+ x=0.5
517
+ ),
518
  xaxis=dict(title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
519
  yaxis=dict(title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
520
+ hovermode='x unified',
521
+ margin=dict(b=120)
522
  )
523
 
524
  return {