Spaces:
Sleeping
Sleeping
Download run.py from Corin1998/IR_PR_PilotPro: direct link, hf CLI and curl.
- Browser
- Download file 795 Bytes
-
https://huggingface.co/spaces/Corin1998/IR_PR_PilotPro/resolve/main/run.py
- Command line
-
hf download hf://spaces/Corin1998/IR_PR_PilotPro/run.py
-
curl -L -o run.py https://huggingface.co/spaces/Corin1998/IR_PR_PilotPro/resolve/main/run.py
795 Bytes
| # run.py | |
| """ | |
| Uvicorn 起動用エントリ。 | |
| - 優先して irpr.main を読み込む | |
| - なければ app.main をフォールバックで読み込む | |
| """ | |
| import os | |
| import sys | |
| import importlib | |
| # /code(リポジトリルート)をパスに追加 | |
| ROOT = os.path.dirname(os.path.abspath(__file__)) | |
| if ROOT not in sys.path: | |
| sys.path.insert(0, ROOT) | |
| last_err = None | |
| app = None | |
| for target in ("irpr.main", "app.main"): | |
| try: | |
| mod = importlib.import_module(target) | |
| app = getattr(mod, "app") | |
| break | |
| except Exception as e: | |
| last_err = e | |
| continue | |
| if app is None: | |
| raise RuntimeError( | |
| "Failed to import FastAPI app from irpr.main or app.main. " | |
| "Make sure one of them exists and defines `app = FastAPI(...)`." | |
| ) from last_err | |