Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -58,6 +58,8 @@ else:
|
|
| 58 |
logger.warning("HF_TOKEN environment variable not set. Logging to Hugging Face Hub will be disabled.")
|
| 59 |
|
| 60 |
def log_prediction(log_data: dict):
|
|
|
|
|
|
|
| 61 |
if not api:
|
| 62 |
return
|
| 63 |
|
|
@@ -65,6 +67,8 @@ def log_prediction(log_data: dict):
|
|
| 65 |
timestamp = log_data.get('timestamp', datetime.now().timestamp())
|
| 66 |
|
| 67 |
try:
|
|
|
|
|
|
|
| 68 |
api.upload_file(
|
| 69 |
path_or_fileobj=json.dumps(log_data, indent=2, ensure_ascii=False).encode('utf-8'),
|
| 70 |
path_in_repo=f"predictions/{day}/{timestamp}.json",
|
|
|
|
| 58 |
logger.warning("HF_TOKEN environment variable not set. Logging to Hugging Face Hub will be disabled.")
|
| 59 |
|
| 60 |
def log_prediction(log_data: dict):
|
| 61 |
+
logger.info("Logging to Hugging Face Hub...")
|
| 62 |
+
|
| 63 |
if not api:
|
| 64 |
return
|
| 65 |
|
|
|
|
| 67 |
timestamp = log_data.get('timestamp', datetime.now().timestamp())
|
| 68 |
|
| 69 |
try:
|
| 70 |
+
logger.info("Logging to Hugging Face Hub upload_file: ", dict)
|
| 71 |
+
|
| 72 |
api.upload_file(
|
| 73 |
path_or_fileobj=json.dumps(log_data, indent=2, ensure_ascii=False).encode('utf-8'),
|
| 74 |
path_in_repo=f"predictions/{day}/{timestamp}.json",
|