-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.py
39 lines (29 loc) · 1.88 KB
/
install.py
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import os
import sys
from torchvision.datasets.utils import download_url
subpack_path = os.path.join(os.path.dirname(__file__))
quasar_path = os.environ.get('QUASARUI_PATH')
if quasar_path is None:
print(f"\n[bold yellow]WARN: The `QUASARUI_PATH` environment variable is not set. Assuming `{os.path.dirname(__file__)}/../../../` as the QuasarUI path.[/bold yellow]", file=sys.stderr)
quasar_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
sys.path.append(quasar_path)
model_path = os.environ.get('QUASARUI_MODEL_PATH')
if model_path is None:
print(f"\n[bold yellow]WARN: The `QUASARUI_MODEL_PATH` environment variable is not set. Assuming `{model_path}` as the QuasarUI path.[/bold yellow]", file=sys.stderr)
model_path = os.path.abspath(os.path.join(quasar_path, 'models'))
ultralytics_bbox_path = os.path.join(model_path, "ultralytics", "bbox")
ultralytics_segm_path = os.path.join(model_path, "ultralytics", "segm")
if not os.path.exists(os.path.join(subpack_path, '..', '..', 'skip_download_model')):
if not os.path.exists(ultralytics_bbox_path):
os.makedirs(ultralytics_bbox_path)
if not os.path.exists(ultralytics_segm_path):
os.makedirs(ultralytics_segm_path)
if not os.path.exists(os.path.join(ultralytics_bbox_path, "face_yolov8m.pt")):
download_url("https://huggingface.co/Bingsu/adetailer/resolve/main/face_yolov8m.pt",
ultralytics_bbox_path)
if not os.path.exists(os.path.join(ultralytics_bbox_path, "hand_yolov8s.pt")):
download_url("https://huggingface.co/Bingsu/adetailer/resolve/main/hand_yolov8s.pt",
ultralytics_bbox_path)
if not os.path.exists(os.path.join(ultralytics_segm_path, "person_yolov8m-seg.pt")):
download_url("https://huggingface.co/Bingsu/adetailer/resolve/main/person_yolov8m-seg.pt",
ultralytics_segm_path)