wenhanacademia commited on
Commit
3d931ce
·
verified ·
1 Parent(s): bcddf1d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from huggingface_hub import snapshot_download
2
+ import os
3
+ import sys
4
+
5
+ # =====================================
6
+ # 0. Configuration
7
+ # =====================================
8
+ REPO_ID = "wenhanacademia/ai_paper_finder" # your private repo with DB + code
9
+ HF_TOKEN = os.getenv("HF_TOKEN") # set in Space Settings → Variables
10
+ ENTRY_FILE = "app.py" # entry point inside that repo
11
+
12
+ # =====================================
13
+ # 1. Download private repo to runtime
14
+ # =====================================
15
+ print(f"Downloading repo {REPO_ID} ...")
16
+ repo_dir = snapshot_download(repo_id=REPO_ID, token=HF_TOKEN)
17
+
18
+ # =====================================
19
+ # 2. Add to sys.path and execute app
20
+ # =====================================
21
+ sys.path.append(repo_dir)
22
+ entry_path = os.path.join(repo_dir, ENTRY_FILE)
23
+
24
+ print(f"Running {entry_path} ...")
25
+ exec(open(entry_path).read())