Spaces:
Running
Running
Download app.py from andyangjunlong/careertwin: direct link, hf CLI and curl.
- Browser
- Download file 715 Bytes
-
https://huggingface.co/spaces/andyangjunlong/careertwin/resolve/main/app.py
- Command line
-
hf download hf://spaces/andyangjunlong/careertwin/app.py
-
curl -L -o app.py https://huggingface.co/spaces/andyangjunlong/careertwin/resolve/main/app.py
715 Bytes
| 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__") | |