Spaces:
Running
Running
hysts
commited on
Commit
•
02c2b6d
1
Parent(s):
b2c2519
Update
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
from __future__ import annotations
|
4 |
|
5 |
import os
|
|
|
6 |
import shlex
|
7 |
import subprocess
|
8 |
|
@@ -11,17 +12,23 @@ import gradio as gr
|
|
11 |
if os.getenv('SYSTEM') == 'spaces':
|
12 |
with open('patch') as f:
|
13 |
subprocess.run(shlex.split('patch -p1'), stdin=f, cwd='ControlNet')
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
from gradio_canny2image import create_demo as create_demo_canny
|
27 |
from gradio_depth2image import create_demo as create_demo_depth
|
|
|
3 |
from __future__ import annotations
|
4 |
|
5 |
import os
|
6 |
+
import pathlib
|
7 |
import shlex
|
8 |
import subprocess
|
9 |
|
|
|
12 |
if os.getenv('SYSTEM') == 'spaces':
|
13 |
with open('patch') as f:
|
14 |
subprocess.run(shlex.split('patch -p1'), stdin=f, cwd='ControlNet')
|
15 |
+
|
16 |
+
base_url = 'https://huggingface.co/lllyasviel/ControlNet/resolve/main/annotator/ckpts/'
|
17 |
+
names = [
|
18 |
+
'body_pose_model.pth',
|
19 |
+
'dpt_hybrid-midas-501f0c75.pt',
|
20 |
+
'hand_pose_model.pth',
|
21 |
+
'mlsd_large_512_fp32.pth',
|
22 |
+
'mlsd_tiny_512_fp32.pth',
|
23 |
+
'network-bsds500.pth',
|
24 |
+
'upernet_global_small.pth',
|
25 |
+
]
|
26 |
+
for name in names:
|
27 |
+
command = f'wget https://huggingface.co/lllyasviel/ControlNet/resolve/main/annotator/ckpts/{name} -O {name}'
|
28 |
+
out_path = pathlib.Path(f'ControlNet/annotator/ckpts/{name}')
|
29 |
+
if out_path.exists():
|
30 |
+
continue
|
31 |
+
subprocess.run(shlex.split(command), cwd='ControlNet/annotator/ckpts/')
|
32 |
|
33 |
from gradio_canny2image import create_demo as create_demo_canny
|
34 |
from gradio_depth2image import create_demo as create_demo_depth
|
model.py
CHANGED
@@ -38,7 +38,7 @@ ORIGINAL_MODEL_NAMES = {
|
|
38 |
'depth': 'control_sd15_depth.pth',
|
39 |
'normal': 'control_sd15_normal.pth',
|
40 |
}
|
41 |
-
ORIGINAL_WEIGHT_ROOT = 'https://huggingface.co/
|
42 |
|
43 |
LIGHTWEIGHT_MODEL_NAMES = {
|
44 |
'canny': 'control_canny-fp16.safetensors',
|
|
|
38 |
'depth': 'control_sd15_depth.pth',
|
39 |
'normal': 'control_sd15_normal.pth',
|
40 |
}
|
41 |
+
ORIGINAL_WEIGHT_ROOT = 'https://huggingface.co/lllyasviel/ControlNet/resolve/main/models/'
|
42 |
|
43 |
LIGHTWEIGHT_MODEL_NAMES = {
|
44 |
'canny': 'control_canny-fp16.safetensors',
|