Spaces:
Runtime error
Runtime error
Download settings.py from tkau/streamlit-api: direct link, hf CLI and curl.
- Browser
- Download file 1.04 kB
-
https://huggingface.co/spaces/tkau/streamlit-api/resolve/refs%2Fpr%2F1/settings.py
- Command line
-
hf download hf://spaces/tkau/streamlit-api@refs/pr/1/settings.py
-
curl -L -o settings.py https://huggingface.co/spaces/tkau/streamlit-api/resolve/refs%2Fpr%2F1/settings.py
1.04 kB
| import sys | |
| from pathlib import Path | |
| # 获取当前文件的绝对路径 | |
| file_path = Path(__file__).resolve() | |
| print("file_path",file_path) | |
| # 获取当前文件的父路径 | |
| root_path = file_path.parent | |
| print("root_path",root_path) | |
| # 获取总项目的根路径 | |
| model_root_path = root_path.parent | |
| print("model_root_path",model_root_path) | |
| # Add the root path to the sys.path list if it is not already there | |
| if root_path not in sys.path: | |
| sys.path.append(str(root_path)) | |
| # 获取settings文件对于当前工作目录的相对路径 | |
| ROOT = root_path.relative_to(Path.cwd()) | |
| print("Path.cwd()",Path.cwd()) | |
| print("ROOT",ROOT)# . | |
| # Sources | |
| IMAGE = 'Image' | |
| RTSP = 'RTSP' | |
| SOURCES_LIST = [IMAGE, RTSP] | |
| # Images config | |
| IMAGES_DIR = ROOT / 'images' | |
| DEFAULT_IMAGE = IMAGES_DIR / 'office_4.jpg' | |
| DEFAULT_DETECT_IMAGE = IMAGES_DIR / 'office_4_detected.jpg' | |
| # ML Model config | |
| MODEL_DIR = ROOT / 'weights' | |
| DETECTION_MODEL = MODEL_DIR / 'yolov8n.pt' | |
| SEGMENTATION_MODEL = MODEL_DIR / 'yolov8n-seg.pt' | |
| SECURITY_MODEL = MODEL_DIR / 'yolov8n-sec.pt' | |