Upload folder using huggingface_hub
Browse files- app.py +13 -36
- data.py +51 -5
- styles.css +1 -11
app.py
CHANGED
|
@@ -231,12 +231,6 @@ with gr.Blocks(title="Model Test Results Dashboard", css=load_css()) as demo:
|
|
| 231 |
# Historical view components (hidden by default)
|
| 232 |
with gr.Column(visible=False, elem_classes=["historical-view"]) as historical_view:
|
| 233 |
|
| 234 |
-
# Loading indicator
|
| 235 |
-
loading_indicator = gr.Markdown(
|
| 236 |
-
"⏳ Loading historical data...",
|
| 237 |
-
visible=False,
|
| 238 |
-
elem_classes=["loading-indicator"]
|
| 239 |
-
)
|
| 240 |
|
| 241 |
# Time-series summary displays (multiple Gradio plots)
|
| 242 |
time_series_failure_rates = gr.LinePlot(
|
|
@@ -456,20 +450,13 @@ with gr.Blocks(title="Model Test Results Dashboard", css=load_css()) as demo:
|
|
| 456 |
if (hasattr(Ci_results, 'cached_start_date') and hasattr(Ci_results, 'cached_end_date') and
|
| 457 |
Ci_results.cached_start_date == start_date_val and Ci_results.cached_end_date == end_date_val and
|
| 458 |
not Ci_results.historical_df.empty):
|
| 459 |
-
# Use cached data -
|
| 460 |
-
yield (gr.update(visible=True), gr.update(), gr.update(), gr.update())
|
| 461 |
-
yield (gr.update(visible=False), gr.update(), gr.update(), gr.update())
|
| 462 |
-
|
| 463 |
plots = create_time_series_summary_gradio(Ci_results.historical_df)
|
| 464 |
-
|
| 465 |
-
return
|
| 466 |
|
| 467 |
# Auto-load historical data if dates are available
|
| 468 |
if start_date_val and end_date_val:
|
| 469 |
try:
|
| 470 |
-
# Show loading indicator
|
| 471 |
-
yield (gr.update(visible=True), gr.update(), gr.update(), gr.update())
|
| 472 |
-
|
| 473 |
Ci_results.load_historical_data(start_date_val, end_date_val)
|
| 474 |
|
| 475 |
if not Ci_results.historical_df.empty:
|
|
@@ -477,18 +464,15 @@ with gr.Blocks(title="Model Test Results Dashboard", css=load_css()) as demo:
|
|
| 477 |
Ci_results.cached_start_date = start_date_val
|
| 478 |
Ci_results.cached_end_date = end_date_val
|
| 479 |
|
| 480 |
-
# Hide loading indicator and show plots
|
| 481 |
-
yield (gr.update(visible=False), gr.update(), gr.update(), gr.update())
|
| 482 |
-
|
| 483 |
plots = create_time_series_summary_gradio(Ci_results.historical_df)
|
| 484 |
-
|
| 485 |
else:
|
| 486 |
-
|
| 487 |
except Exception as e:
|
| 488 |
logger.error(f"Error auto-loading historical data: {e}")
|
| 489 |
-
|
| 490 |
else:
|
| 491 |
-
|
| 492 |
|
| 493 |
current_view_button.click(
|
| 494 |
fn=toggle_to_current_view,
|
|
@@ -500,29 +484,22 @@ with gr.Blocks(title="Model Test Results Dashboard", css=load_css()) as demo:
|
|
| 500 |
outputs=[current_view, historical_view, date_toggle_button, summary_button, current_view_button, historical_view_button, time_series_failure_rates, time_series_amd_tests, time_series_nvidia_tests]
|
| 501 |
).then(
|
| 502 |
fn=auto_load_historical_data,
|
| 503 |
-
outputs=[
|
| 504 |
)
|
| 505 |
|
| 506 |
# Historical data loading functionality
|
| 507 |
def load_historical_data(start_date, end_date):
|
| 508 |
-
"""Load and display historical data
|
| 509 |
if not start_date or not end_date:
|
| 510 |
logger.error("No start or end date provided")
|
| 511 |
-
return
|
| 512 |
|
| 513 |
try:
|
| 514 |
-
# Show loading indicator
|
| 515 |
-
yield (gr.update(visible=True), gr.update(), gr.update(), gr.update())
|
| 516 |
-
|
| 517 |
Ci_results.load_historical_data(start_date, end_date)
|
| 518 |
|
| 519 |
if Ci_results.historical_df.empty:
|
| 520 |
logger.error("No historical data found for the selected date range")
|
| 521 |
-
|
| 522 |
-
return
|
| 523 |
-
|
| 524 |
-
# Hide loading indicator and show plots
|
| 525 |
-
yield (gr.update(visible=False), gr.update(), gr.update(), gr.update())
|
| 526 |
|
| 527 |
# Create time-series summary plots
|
| 528 |
plots = create_time_series_summary_gradio(Ci_results.historical_df)
|
|
@@ -531,16 +508,16 @@ with gr.Blocks(title="Model Test Results Dashboard", css=load_css()) as demo:
|
|
| 531 |
Ci_results.cached_start_date = start_date
|
| 532 |
Ci_results.cached_end_date = end_date
|
| 533 |
|
| 534 |
-
|
| 535 |
|
| 536 |
except Exception as e:
|
| 537 |
logger.error(f"Error loading historical data: {e}")
|
| 538 |
-
|
| 539 |
|
| 540 |
load_historical_button.click(
|
| 541 |
fn=load_historical_data,
|
| 542 |
inputs=[start_date, end_date],
|
| 543 |
-
outputs=[
|
| 544 |
)
|
| 545 |
|
| 546 |
# Time-series model selection functionality
|
|
|
|
| 231 |
# Historical view components (hidden by default)
|
| 232 |
with gr.Column(visible=False, elem_classes=["historical-view"]) as historical_view:
|
| 233 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 234 |
|
| 235 |
# Time-series summary displays (multiple Gradio plots)
|
| 236 |
time_series_failure_rates = gr.LinePlot(
|
|
|
|
| 450 |
if (hasattr(Ci_results, 'cached_start_date') and hasattr(Ci_results, 'cached_end_date') and
|
| 451 |
Ci_results.cached_start_date == start_date_val and Ci_results.cached_end_date == end_date_val and
|
| 452 |
not Ci_results.historical_df.empty):
|
| 453 |
+
# Use cached data - no loading indicator needed
|
|
|
|
|
|
|
|
|
|
| 454 |
plots = create_time_series_summary_gradio(Ci_results.historical_df)
|
| 455 |
+
return plots['failure_rates'], plots['amd_tests'], plots['nvidia_tests']
|
|
|
|
| 456 |
|
| 457 |
# Auto-load historical data if dates are available
|
| 458 |
if start_date_val and end_date_val:
|
| 459 |
try:
|
|
|
|
|
|
|
|
|
|
| 460 |
Ci_results.load_historical_data(start_date_val, end_date_val)
|
| 461 |
|
| 462 |
if not Ci_results.historical_df.empty:
|
|
|
|
| 464 |
Ci_results.cached_start_date = start_date_val
|
| 465 |
Ci_results.cached_end_date = end_date_val
|
| 466 |
|
|
|
|
|
|
|
|
|
|
| 467 |
plots = create_time_series_summary_gradio(Ci_results.historical_df)
|
| 468 |
+
return plots['failure_rates'], plots['amd_tests'], plots['nvidia_tests']
|
| 469 |
else:
|
| 470 |
+
return gr.update(), gr.update(), gr.update()
|
| 471 |
except Exception as e:
|
| 472 |
logger.error(f"Error auto-loading historical data: {e}")
|
| 473 |
+
return gr.update(), gr.update(), gr.update()
|
| 474 |
else:
|
| 475 |
+
return gr.update(), gr.update(), gr.update()
|
| 476 |
|
| 477 |
current_view_button.click(
|
| 478 |
fn=toggle_to_current_view,
|
|
|
|
| 484 |
outputs=[current_view, historical_view, date_toggle_button, summary_button, current_view_button, historical_view_button, time_series_failure_rates, time_series_amd_tests, time_series_nvidia_tests]
|
| 485 |
).then(
|
| 486 |
fn=auto_load_historical_data,
|
| 487 |
+
outputs=[time_series_failure_rates, time_series_amd_tests, time_series_nvidia_tests]
|
| 488 |
)
|
| 489 |
|
| 490 |
# Historical data loading functionality
|
| 491 |
def load_historical_data(start_date, end_date):
|
| 492 |
+
"""Load and display historical data."""
|
| 493 |
if not start_date or not end_date:
|
| 494 |
logger.error("No start or end date provided")
|
| 495 |
+
return gr.update(), gr.update(), gr.update()
|
| 496 |
|
| 497 |
try:
|
|
|
|
|
|
|
|
|
|
| 498 |
Ci_results.load_historical_data(start_date, end_date)
|
| 499 |
|
| 500 |
if Ci_results.historical_df.empty:
|
| 501 |
logger.error("No historical data found for the selected date range")
|
| 502 |
+
return gr.update(), gr.update(), gr.update()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 503 |
|
| 504 |
# Create time-series summary plots
|
| 505 |
plots = create_time_series_summary_gradio(Ci_results.historical_df)
|
|
|
|
| 508 |
Ci_results.cached_start_date = start_date
|
| 509 |
Ci_results.cached_end_date = end_date
|
| 510 |
|
| 511 |
+
return plots['failure_rates'], plots['amd_tests'], plots['nvidia_tests']
|
| 512 |
|
| 513 |
except Exception as e:
|
| 514 |
logger.error(f"Error loading historical data: {e}")
|
| 515 |
+
return gr.update(), gr.update(), gr.update()
|
| 516 |
|
| 517 |
load_historical_button.click(
|
| 518 |
fn=load_historical_data,
|
| 519 |
inputs=[start_date, end_date],
|
| 520 |
+
outputs=[time_series_failure_rates, time_series_amd_tests, time_series_nvidia_tests]
|
| 521 |
)
|
| 522 |
|
| 523 |
# Time-series model selection functionality
|
data.py
CHANGED
|
@@ -417,6 +417,7 @@ class CIResults:
|
|
| 417 |
self.latest_update_msg = ""
|
| 418 |
self.available_dates = []
|
| 419 |
self.historical_df = pd.DataFrame()
|
|
|
|
| 420 |
|
| 421 |
def load_data(self) -> None:
|
| 422 |
"""Load data from the data source."""
|
|
@@ -455,6 +456,10 @@ class CIResults:
|
|
| 455 |
# Update attributes
|
| 456 |
self.df = new_df
|
| 457 |
self.available_models = new_df.index.tolist()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 458 |
# Log and return distant load status
|
| 459 |
logger.info(f"Data loaded successfully: {len(self.available_models)} models")
|
| 460 |
logger.info(f"Models: {self.available_models[:5]}{'...' if len(self.available_models) > 5 else ''}")
|
|
@@ -472,14 +477,55 @@ class CIResults:
|
|
| 472 |
msg[model][col] = value
|
| 473 |
logger.info(json.dumps(msg, indent=4))
|
| 474 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 475 |
def load_historical_data(self, start_date: str, end_date: str) -> None:
|
| 476 |
-
"""Load historical data for a date range."""
|
| 477 |
try:
|
| 478 |
-
logger.info(f"
|
| 479 |
-
|
| 480 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 481 |
except Exception as e:
|
| 482 |
-
logger.error(f"Error
|
| 483 |
self.historical_df = pd.DataFrame()
|
| 484 |
|
| 485 |
def schedule_data_reload(self):
|
|
|
|
| 417 |
self.latest_update_msg = ""
|
| 418 |
self.available_dates = []
|
| 419 |
self.historical_df = pd.DataFrame()
|
| 420 |
+
self.all_historical_data = pd.DataFrame() # Store all historical data at startup
|
| 421 |
|
| 422 |
def load_data(self) -> None:
|
| 423 |
"""Load data from the data source."""
|
|
|
|
| 456 |
# Update attributes
|
| 457 |
self.df = new_df
|
| 458 |
self.available_models = new_df.index.tolist()
|
| 459 |
+
|
| 460 |
+
# Load all historical data at startup
|
| 461 |
+
self.load_all_historical_data()
|
| 462 |
+
|
| 463 |
# Log and return distant load status
|
| 464 |
logger.info(f"Data loaded successfully: {len(self.available_models)} models")
|
| 465 |
logger.info(f"Models: {self.available_models[:5]}{'...' if len(self.available_models) > 5 else ''}")
|
|
|
|
| 477 |
msg[model][col] = value
|
| 478 |
logger.info(json.dumps(msg, indent=4))
|
| 479 |
|
| 480 |
+
def load_all_historical_data(self) -> None:
|
| 481 |
+
"""Load all available historical data at startup."""
|
| 482 |
+
try:
|
| 483 |
+
if not self.available_dates:
|
| 484 |
+
logger.warning("No available dates found, skipping historical data loading")
|
| 485 |
+
self.all_historical_data = pd.DataFrame()
|
| 486 |
+
return
|
| 487 |
+
|
| 488 |
+
logger.info(f"Loading all historical data for {len(self.available_dates)} dates...")
|
| 489 |
+
start_date = self.available_dates[-1] # Oldest date
|
| 490 |
+
end_date = self.available_dates[0] # Newest date
|
| 491 |
+
|
| 492 |
+
self.all_historical_data = get_historical_data(start_date, end_date)
|
| 493 |
+
logger.info(f"All historical data loaded: {len(self.all_historical_data)} records")
|
| 494 |
+
except Exception as e:
|
| 495 |
+
logger.error(f"Error loading all historical data: {e}")
|
| 496 |
+
self.all_historical_data = pd.DataFrame()
|
| 497 |
+
|
| 498 |
def load_historical_data(self, start_date: str, end_date: str) -> None:
|
| 499 |
+
"""Load historical data for a date range from pre-loaded data."""
|
| 500 |
try:
|
| 501 |
+
logger.info(f"Filtering historical data from {start_date} to {end_date}")
|
| 502 |
+
|
| 503 |
+
if self.all_historical_data.empty:
|
| 504 |
+
logger.warning("No pre-loaded historical data available")
|
| 505 |
+
self.historical_df = pd.DataFrame()
|
| 506 |
+
return
|
| 507 |
+
|
| 508 |
+
# Filter the pre-loaded data by date range
|
| 509 |
+
start_dt = datetime.strptime(start_date, "%Y-%m-%d")
|
| 510 |
+
end_dt = datetime.strptime(end_date, "%Y-%m-%d")
|
| 511 |
+
|
| 512 |
+
# Filter data within the date range
|
| 513 |
+
filtered_data = []
|
| 514 |
+
for date_str in self.all_historical_data['date'].unique():
|
| 515 |
+
date_dt = datetime.strptime(date_str, "%Y-%m-%d")
|
| 516 |
+
if start_dt <= date_dt <= end_dt:
|
| 517 |
+
date_data = self.all_historical_data[self.all_historical_data['date'] == date_str]
|
| 518 |
+
filtered_data.append(date_data)
|
| 519 |
+
|
| 520 |
+
if filtered_data:
|
| 521 |
+
self.historical_df = pd.concat(filtered_data, ignore_index=False)
|
| 522 |
+
logger.info(f"Historical data filtered: {len(self.historical_df)} records for {start_date} to {end_date}")
|
| 523 |
+
else:
|
| 524 |
+
self.historical_df = pd.DataFrame()
|
| 525 |
+
logger.warning(f"No historical data found for date range {start_date} to {end_date}")
|
| 526 |
+
|
| 527 |
except Exception as e:
|
| 528 |
+
logger.error(f"Error filtering historical data: {e}")
|
| 529 |
self.historical_df = pd.DataFrame()
|
| 530 |
|
| 531 |
def schedule_data_reload(self):
|
styles.css
CHANGED
|
@@ -3,17 +3,7 @@
|
|
| 3 |
--main-content-bottom-margin: 10px; /* Configurable bottom margin for main content */
|
| 4 |
}
|
| 5 |
|
| 6 |
-
|
| 7 |
-
.loading-indicator {
|
| 8 |
-
text-align: center !important;
|
| 9 |
-
padding: 20px !important;
|
| 10 |
-
font-size: 16px !important;
|
| 11 |
-
color: #ffa500 !important;
|
| 12 |
-
background: rgba(255, 165, 0, 0.1) !important;
|
| 13 |
-
border-radius: 8px !important;
|
| 14 |
-
margin: 10px 0 !important;
|
| 15 |
-
border: 1px solid rgba(255, 165, 0, 0.3) !important;
|
| 16 |
-
}
|
| 17 |
|
| 18 |
.gradio-container {
|
| 19 |
background-color: #000000 !important;
|
|
|
|
| 3 |
--main-content-bottom-margin: 10px; /* Configurable bottom margin for main content */
|
| 4 |
}
|
| 5 |
|
| 6 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
.gradio-container {
|
| 9 |
background-color: #000000 !important;
|