File size: 921 Bytes
3d931ce
 
ab9c854
 
 
 
 
3d931ce
ab9c854
 
 
 
 
3d931ce
 
 
ab9c854
3d931ce
ab9c854
 
3d931ce
 
ab9c854
3d931ce
ab9c854
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os
import sys
import datetime
import runpy
from huggingface_hub import snapshot_download

print(f"===== Application Startup at {datetime.datetime.now():%Y-%m-%d %H:%M:%S} =====")

# ---------------- CONFIG ----------------
REPO_ID = "wenhanacademia/ai_paper_finder"   # private repo with full app + DB
HF_TOKEN = os.getenv("HF_TOKEN", "").strip()  # stored as secret
ENTRY_FILE = "app.py"                         # entry point in that repo
# -----------------------------------------

print(f"Downloading repo {REPO_ID} ...")
repo_dir = snapshot_download(repo_id=REPO_ID, token=HF_TOKEN)
print(f"Repo downloaded to: {repo_dir}")

# Change to the repo directory so relative paths work
os.chdir(repo_dir)
sys.path.append(repo_dir)

entry_path = os.path.join(repo_dir, ENTRY_FILE)
print(f"Running {entry_path} ...")

# Execute your repo’s real app in its own context
runpy.run_path(entry_path, run_name="__main__")