Spaces:
Sleeping
Sleeping
Update same msg
Browse files
data.py
CHANGED
|
@@ -127,10 +127,10 @@ def get_distant_data() -> tuple[pd.DataFrame, str]:
|
|
| 127 |
return filtered_joined, latest_update_msg
|
| 128 |
|
| 129 |
|
| 130 |
-
def get_sample_data() -> pd.DataFrame:
|
| 131 |
# Retrieve sample dataframes
|
| 132 |
-
df_amd = read_one_dataframe("sample_amd.json", "amd")
|
| 133 |
-
df_nvidia = read_one_dataframe("sample_nvidia.json", "nvidia")
|
| 134 |
# Join both dataframes
|
| 135 |
joined = df_amd.join(df_nvidia, rsuffix="_nvidia", lsuffix="_amd", how="outer")
|
| 136 |
joined = joined[KEYS_TO_KEEP]
|
|
@@ -140,7 +140,7 @@ def get_sample_data() -> pd.DataFrame:
|
|
| 140 |
filtered_joined = joined[joined.index.str.lower().isin(important_models_lower)]
|
| 141 |
# Prefix all model names with "sample_"
|
| 142 |
filtered_joined.index = "sample_" + filtered_joined.index
|
| 143 |
-
return filtered_joined
|
| 144 |
|
| 145 |
def safe_extract(row: pd.DataFrame, key: str) -> int:
|
| 146 |
return int(row.get(key, 0)) if pd.notna(row.get(key, 0)) else 0
|
|
@@ -201,7 +201,8 @@ class CIResults:
|
|
| 201 |
"Falling back on sample data."
|
| 202 |
]
|
| 203 |
logger.error("\n".join(error_msg))
|
| 204 |
-
new_df = get_sample_data()
|
|
|
|
| 205 |
# Update attributes
|
| 206 |
self.df = new_df
|
| 207 |
self.available_models = new_df.index.tolist()
|
|
|
|
| 127 |
return filtered_joined, latest_update_msg
|
| 128 |
|
| 129 |
|
| 130 |
+
def get_sample_data() -> tuple[pd.DataFrame, str]:
|
| 131 |
# Retrieve sample dataframes
|
| 132 |
+
df_amd, _ = read_one_dataframe("sample_amd.json", "amd")
|
| 133 |
+
df_nvidia, _ = read_one_dataframe("sample_nvidia.json", "nvidia")
|
| 134 |
# Join both dataframes
|
| 135 |
joined = df_amd.join(df_nvidia, rsuffix="_nvidia", lsuffix="_amd", how="outer")
|
| 136 |
joined = joined[KEYS_TO_KEEP]
|
|
|
|
| 140 |
filtered_joined = joined[joined.index.str.lower().isin(important_models_lower)]
|
| 141 |
# Prefix all model names with "sample_"
|
| 142 |
filtered_joined.index = "sample_" + filtered_joined.index
|
| 143 |
+
return filtered_joined, "sample data was loaded"
|
| 144 |
|
| 145 |
def safe_extract(row: pd.DataFrame, key: str) -> int:
|
| 146 |
return int(row.get(key, 0)) if pd.notna(row.get(key, 0)) else 0
|
|
|
|
| 201 |
"Falling back on sample data."
|
| 202 |
]
|
| 203 |
logger.error("\n".join(error_msg))
|
| 204 |
+
new_df, latest_update_msg = get_sample_data()
|
| 205 |
+
self.latest_update_msg = latest_update_msg
|
| 206 |
# Update attributes
|
| 207 |
self.df = new_df
|
| 208 |
self.available_models = new_df.index.tolist()
|