Jofthomas HF Staff commited on
Commit
20e689c
·
verified ·
1 Parent(s): f5e9274

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +6 -5
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.warning(f"Could not load dataset '{HF_DATASET_ID}' or it's empty/new ({load_error}). Will create structure.")
311
-
312
- df = pd.DataFrame({col: pd.Series(dtype=dtype) for col, dtype in expected_columns.items()})
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: