Spaces:
Running
Running
Pull existing log from HF on startup to prevent overwrites on restart
Browse files
app.py
CHANGED
|
@@ -55,7 +55,18 @@ def load_model():
|
|
| 55 |
|
| 56 |
@st.cache_resource
|
| 57 |
def get_scheduler():
|
|
|
|
| 58 |
LOG_DIR.mkdir(exist_ok=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
return CommitScheduler(
|
| 60 |
repo_id=LOG_REPO,
|
| 61 |
repo_type="dataset",
|
|
|
|
| 55 |
|
| 56 |
@st.cache_resource
|
| 57 |
def get_scheduler():
|
| 58 |
+
import shutil
|
| 59 |
LOG_DIR.mkdir(exist_ok=True)
|
| 60 |
+
# Pull existing log from HF on startup so we append instead of overwrite
|
| 61 |
+
try:
|
| 62 |
+
existing = hf_hub_download(
|
| 63 |
+
repo_id=LOG_REPO,
|
| 64 |
+
filename="logs/predictions.csv",
|
| 65 |
+
repo_type="dataset",
|
| 66 |
+
)
|
| 67 |
+
shutil.copy(existing, LOG_FILE)
|
| 68 |
+
except Exception:
|
| 69 |
+
pass # no log yet, start fresh
|
| 70 |
return CommitScheduler(
|
| 71 |
repo_id=LOG_REPO,
|
| 72 |
repo_type="dataset",
|