AdhyanshVerma commited on
Commit
207535f
Β·
verified Β·
1 Parent(s): 792d280

Upload 16 files

Browse files
Files changed (3) hide show
  1. app.py +1 -1
  2. pipeline/orchestrator.py +12 -3
  3. requirements.txt +1 -0
app.py CHANGED
@@ -277,7 +277,7 @@ def trigger_kaggle_workers(db_path, links_per_worker, max_workers):
277
  shutil.copytree("worker", worker_path / "worker")
278
  else:
279
  # We copy from parent directory if this is running locally, otherwise it's an error on HF unless packed
280
- parent_worker = Path("../hf_space_worker/worker")
281
  if parent_worker.exists():
282
  shutil.copytree(parent_worker, worker_path / "worker")
283
  else:
 
277
  shutil.copytree("worker", worker_path / "worker")
278
  else:
279
  # We copy from parent directory if this is running locally, otherwise it's an error on HF unless packed
280
+ parent_worker = Path("../worker")
281
  if parent_worker.exists():
282
  shutil.copytree(parent_worker, worker_path / "worker")
283
  else:
pipeline/orchestrator.py CHANGED
@@ -28,9 +28,18 @@ log = logging.getLogger("orchestrator")
28
 
29
  # ── paths & constants ────────────────────────────────────────────────
30
  BASE_DIR = Path(__file__).resolve().parent.parent
31
- DB_ACCOUNTS = Path("/data/accounts.db")
32
- DB_CHANNELS = Path("/data/channel_links.db")
33
- DB_TRACKER = Path("/data/tracker.db")
 
 
 
 
 
 
 
 
 
34
  WORKERS_DIR = BASE_DIR / "kaggle_workers"
35
  WORKER_SCRIPT = Path(__file__).resolve().parent / "worker.py"
36
  HF_REPO = "AdhyanshVerma/YT"
 
28
 
29
  # ── paths & constants ────────────────────────────────────────────────
30
  BASE_DIR = Path(__file__).resolve().parent.parent
31
+
32
+ DATA_DIR = Path(os.environ.get("DATA_DIR", "/data"))
33
+ if not DATA_DIR.exists():
34
+ try:
35
+ DATA_DIR.mkdir(parents=True, exist_ok=True)
36
+ except PermissionError:
37
+ DATA_DIR = BASE_DIR / "db"
38
+ DATA_DIR.mkdir(parents=True, exist_ok=True)
39
+
40
+ DB_ACCOUNTS = DATA_DIR / "accounts.db"
41
+ DB_CHANNELS = DATA_DIR / "channel_links.db"
42
+ DB_TRACKER = DATA_DIR / "tracker.db"
43
  WORKERS_DIR = BASE_DIR / "kaggle_workers"
44
  WORKER_SCRIPT = Path(__file__).resolve().parent / "worker.py"
45
  HF_REPO = "AdhyanshVerma/YT"
requirements.txt CHANGED
@@ -1,3 +1,4 @@
1
  gradio
2
  requests
3
  kaggle
 
 
1
  gradio
2
  requests
3
  kaggle
4
+ huggingface_hub