Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -304,13 +304,14 @@ def update_huggingface_dataset(username: str, score: float, code_link: str):
|
|
| 304 |
df = ds_dict['train'].to_pandas()
|
| 305 |
else:
|
| 306 |
logger.warning(f"Dataset '{HF_DATASET_ID}' loaded but no 'train' split found. Creating structure.")
|
| 307 |
-
df = pd.DataFrame({col: pd.Series(dtype=dtype) for col, dtype in expected_columns.items()})
|
| 308 |
|
| 309 |
except Exception as load_error:
|
| 310 |
-
logger.
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
|
|
|
| 314 |
|
| 315 |
for col, dtype in expected_columns.items():
|
| 316 |
if col not in df.columns:
|
|
|
|
| 304 |
df = ds_dict['train'].to_pandas()
|
| 305 |
else:
|
| 306 |
logger.warning(f"Dataset '{HF_DATASET_ID}' loaded but no 'train' split found. Creating structure.")
|
| 307 |
+
#df = pd.DataFrame({col: pd.Series(dtype=dtype) for col, dtype in expected_columns.items()})
|
| 308 |
|
| 309 |
except Exception as load_error:
|
| 310 |
+
logger.error(f"CRITICAL: Could not load dataset '{HF_DATASET_ID}'. Error: {load_error}", exc_info=True)
|
| 311 |
+
raise HTTPException(
|
| 312 |
+
status_code=500,
|
| 313 |
+
detail=f"Failed to load required dataset '{HF_DATASET_ID}': {load_error}"
|
| 314 |
+
)
|
| 315 |
|
| 316 |
for col, dtype in expected_columns.items():
|
| 317 |
if col not in df.columns:
|