Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -342,14 +342,23 @@ def commit_logs_to_hf(manual=False):
|
|
| 342 |
return "No new logs."
|
| 343 |
|
| 344 |
date_str = datetime.utcnow().strftime("%Y-%m-%d")
|
| 345 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 346 |
|
| 347 |
api.upload_file(
|
| 348 |
path_or_fileobj=BUFFER_FILE,
|
| 349 |
path_in_repo=repo_path,
|
| 350 |
repo_id=HF_DATASET,
|
| 351 |
repo_type="dataset",
|
| 352 |
-
commit_message=
|
| 353 |
)
|
| 354 |
|
| 355 |
# Clear buffer after successful commit
|
|
|
|
| 342 |
return "No new logs."
|
| 343 |
|
| 344 |
date_str = datetime.utcnow().strftime("%Y-%m-%d")
|
| 345 |
+
|
| 346 |
+
# Add timestamp to make filename unique
|
| 347 |
+
if manual:
|
| 348 |
+
timestamp = datetime.utcnow().strftime("%Y%m%d-%H%M%S")
|
| 349 |
+
repo_path = f"logs/manual_{date_str}_{timestamp}.jsonl"
|
| 350 |
+
commit_msg = f"Manual log commit {timestamp}"
|
| 351 |
+
else:
|
| 352 |
+
timestamp = datetime.utcnow().strftime("%Y%m%d-%H%M%S")
|
| 353 |
+
repo_path = f"logs/auto_{date_str}_{timestamp}.jsonl"
|
| 354 |
+
commit_msg = f"Auto log commit {timestamp}"
|
| 355 |
|
| 356 |
api.upload_file(
|
| 357 |
path_or_fileobj=BUFFER_FILE,
|
| 358 |
path_in_repo=repo_path,
|
| 359 |
repo_id=HF_DATASET,
|
| 360 |
repo_type="dataset",
|
| 361 |
+
commit_message=commit_msg
|
| 362 |
)
|
| 363 |
|
| 364 |
# Clear buffer after successful commit
|