Spaces:
Sleeping
Sleeping
test
Browse files
app.py
CHANGED
|
@@ -347,13 +347,15 @@ def update_season_data(season_year: int = 2026) -> dict:
|
|
| 347 |
print(f"Saved {len(df):,} rows to {local_path}")
|
| 348 |
|
| 349 |
try:
|
| 350 |
-
from huggingface_hub import upload_file
|
|
|
|
|
|
|
| 351 |
upload_file(
|
| 352 |
path_or_fileobj=local_path,
|
| 353 |
path_in_repo=filename,
|
| 354 |
repo_id=_HF_REPO_ID,
|
| 355 |
repo_type="dataset",
|
| 356 |
-
token=
|
| 357 |
)
|
| 358 |
except Exception as e:
|
| 359 |
return {"status": "error", "message": f"HF Hub upload failed: {e}", "rows": len(df), "filename": filename}
|
|
@@ -431,5 +433,6 @@ with gr.Blocks(title="game-sim-v0 | MLB Game Simulator") as demo:
|
|
| 431 |
|
| 432 |
|
| 433 |
if __name__ == "__main__":
|
|
|
|
| 434 |
_ensure_data()
|
| 435 |
demo.launch()
|
|
|
|
| 347 |
print(f"Saved {len(df):,} rows to {local_path}")
|
| 348 |
|
| 349 |
try:
|
| 350 |
+
from huggingface_hub import create_repo, upload_file
|
| 351 |
+
token = os.environ.get("HF_TOKEN")
|
| 352 |
+
create_repo(repo_id=_HF_REPO_ID, repo_type="dataset", token=token, exist_ok=True)
|
| 353 |
upload_file(
|
| 354 |
path_or_fileobj=local_path,
|
| 355 |
path_in_repo=filename,
|
| 356 |
repo_id=_HF_REPO_ID,
|
| 357 |
repo_type="dataset",
|
| 358 |
+
token=token,
|
| 359 |
)
|
| 360 |
except Exception as e:
|
| 361 |
return {"status": "error", "message": f"HF Hub upload failed: {e}", "rows": len(df), "filename": filename}
|
|
|
|
| 433 |
|
| 434 |
|
| 435 |
if __name__ == "__main__":
|
| 436 |
+
print(f"HF_TOKEN present: {bool(os.environ.get('HF_TOKEN'))}")
|
| 437 |
_ensure_data()
|
| 438 |
demo.launch()
|