Spaces:
Sleeping
Sleeping
Commit ·
b7c9230
1
Parent(s): ff75b10
Initial commit
Browse files
app.py
CHANGED
|
@@ -15,7 +15,6 @@ DATASET_REPO_ID = os.environ.get("DATASET_REPO_ID", "fast-stager/property-labels
|
|
| 15 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
| 16 |
|
| 17 |
CACHE_DIR = "/tmp"
|
| 18 |
-
|
| 19 |
URL_FILE = "urls.txt"
|
| 20 |
|
| 21 |
LABEL_FILE = os.path.join(CACHE_DIR, "annotations.csv")
|
|
@@ -35,7 +34,6 @@ def sync_pull():
|
|
| 35 |
print(f"🔄 Syncing from {DATASET_REPO_ID}...")
|
| 36 |
|
| 37 |
for filename in ["annotations.csv", "verifications.csv", "skipped.csv"]:
|
| 38 |
-
target_path = os.path.join(CACHE_DIR, filename)
|
| 39 |
try:
|
| 40 |
hf_hub_download(
|
| 41 |
repo_id=DATASET_REPO_ID,
|
|
@@ -46,7 +44,7 @@ def sync_pull():
|
|
| 46 |
)
|
| 47 |
print(f"✅ Loaded {filename}")
|
| 48 |
except Exception:
|
| 49 |
-
print(f"ℹ️ {filename} not found on Hub. Creating empty.")
|
| 50 |
|
| 51 |
def sync_push_background(local_path, remote_filename):
|
| 52 |
if not HF_TOKEN: return
|
|
@@ -80,6 +78,8 @@ def init_files():
|
|
| 80 |
|
| 81 |
if not os.path.exists(URL_FILE):
|
| 82 |
print("⚠️ urls.txt not found in root directory! Please upload it to your Space.")
|
|
|
|
|
|
|
| 83 |
|
| 84 |
init_files()
|
| 85 |
|
|
|
|
| 15 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
| 16 |
|
| 17 |
CACHE_DIR = "/tmp"
|
|
|
|
| 18 |
URL_FILE = "urls.txt"
|
| 19 |
|
| 20 |
LABEL_FILE = os.path.join(CACHE_DIR, "annotations.csv")
|
|
|
|
| 34 |
print(f"🔄 Syncing from {DATASET_REPO_ID}...")
|
| 35 |
|
| 36 |
for filename in ["annotations.csv", "verifications.csv", "skipped.csv"]:
|
|
|
|
| 37 |
try:
|
| 38 |
hf_hub_download(
|
| 39 |
repo_id=DATASET_REPO_ID,
|
|
|
|
| 44 |
)
|
| 45 |
print(f"✅ Loaded {filename}")
|
| 46 |
except Exception:
|
| 47 |
+
print(f"ℹ️ {filename} not found on Hub. Creating empty in /tmp.")
|
| 48 |
|
| 49 |
def sync_push_background(local_path, remote_filename):
|
| 50 |
if not HF_TOKEN: return
|
|
|
|
| 78 |
|
| 79 |
if not os.path.exists(URL_FILE):
|
| 80 |
print("⚠️ urls.txt not found in root directory! Please upload it to your Space.")
|
| 81 |
+
else:
|
| 82 |
+
print(f"✅ urls.txt found ({len(open(URL_FILE).readlines())} lines)")
|
| 83 |
|
| 84 |
init_files()
|
| 85 |
|