Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -6,13 +6,40 @@ import numpy as np
|
|
6 |
import random
|
7 |
import shutil
|
8 |
|
|
|
9 |
if not os.path.exists("sd-ggml-cpp-dp"):
|
10 |
os.system("git clone https://huggingface.co/svjack/sd-ggml-cpp-dp")
|
11 |
else:
|
12 |
shutil.rmtree("sd-ggml-cpp-dp")
|
13 |
os.system("git clone https://huggingface.co/svjack/sd-ggml-cpp-dp")
|
14 |
assert os.path.exists("sd-ggml-cpp-dp")
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
assert os.path.exists("stable-diffusion.cpp")
|
17 |
os.system("cmake stable-diffusion.cpp")
|
18 |
os.system("cmake --build . --config Release")
|
|
|
6 |
import random
|
7 |
import shutil
|
8 |
|
9 |
+
'''
|
10 |
if not os.path.exists("sd-ggml-cpp-dp"):
|
11 |
os.system("git clone https://huggingface.co/svjack/sd-ggml-cpp-dp")
|
12 |
else:
|
13 |
shutil.rmtree("sd-ggml-cpp-dp")
|
14 |
os.system("git clone https://huggingface.co/svjack/sd-ggml-cpp-dp")
|
15 |
assert os.path.exists("sd-ggml-cpp-dp")
|
16 |
+
'''
|
17 |
+
|
18 |
+
os.system("pip install huggingface_hub")
|
19 |
+
def make_and_download_clean_dir(repo_name = "svjack/sd-ggml"):
|
20 |
+
import shutil
|
21 |
+
import os
|
22 |
+
from tqdm import tqdm
|
23 |
+
from huggingface_hub import HfFileSystem
|
24 |
+
fs = HfFileSystem()
|
25 |
+
req_dir = repo_name.split("/")[-1]
|
26 |
+
if os.path.exists(req_dir):
|
27 |
+
shutil.rmtree(req_dir)
|
28 |
+
os.mkdir(req_dir)
|
29 |
+
os.chdir(req_dir)
|
30 |
+
fd_list = fs.ls(repo_name, detail = False)
|
31 |
+
fd_clean_list = list(filter(lambda x: not x.split("/")[-1].startswith("."), fd_list))
|
32 |
+
for path in tqdm(fd_clean_list):
|
33 |
+
src = path
|
34 |
+
tgt = src.split("/")[-1]
|
35 |
+
print("downloading {} to {}".format(src, tgt))
|
36 |
+
fs.download(
|
37 |
+
src, tgt, recursive = True
|
38 |
+
)
|
39 |
+
os.chdir("..")
|
40 |
+
make_and_download_clean_dir("svjack/sd-ggml")
|
41 |
+
os.chdir("sd-ggml")
|
42 |
+
|
43 |
assert os.path.exists("stable-diffusion.cpp")
|
44 |
os.system("cmake stable-diffusion.cpp")
|
45 |
os.system("cmake --build . --config Release")
|