File size: 715 Bytes
9adb158
 
 
 
 
 
04503f7
9adb158
04503f7
 
 
9adb158
04503f7
 
 
 
 
 
 
9adb158
ee6311a
 
04503f7
5b3be18
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
import os
import subprocess
import runpy

REPO_NAME = "careertwin"

# Clone repo if not exists
if not os.path.exists(REPO_NAME):
    token = os.environ.get("HF_GITHUB_TOKEN")
    GITHUB_USER = "andy-ang"
    REPO_URL = f"https://{token}:x-oauth-basic@github.com/{GITHUB_USER}/{REPO_NAME}.git"
    subprocess.run(["git", "clone", REPO_URL], check=True)
else:
    subprocess.run(["git", "-C", REPO_NAME, "pull"], check=True)

# Install dependencies from requirements.txt
req_file = os.path.join(REPO_NAME, "requirements.txt")
if os.path.exists(req_file):
    subprocess.run(["pip", "install", "--upgrade", "-r", req_file], check=True)

os.chdir(REPO_NAME)

# Run the app
runpy.run_path("app.py", run_name="__main__")