Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,7 +16,12 @@ assert os.path.exists("sd-ggml-cpp-dp")
|
|
| 16 |
'''
|
| 17 |
|
| 18 |
os.system("pip install huggingface_hub")
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
import shutil
|
| 21 |
import os
|
| 22 |
from tqdm import tqdm
|
|
@@ -33,9 +38,22 @@ def make_and_download_clean_dir(repo_name = "svjack/sd-ggml"):
|
|
| 33 |
src = path
|
| 34 |
tgt = src.split("/")[-1]
|
| 35 |
print("downloading {} to {}".format(src, tgt))
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
os.chdir("..")
|
| 40 |
make_and_download_clean_dir("svjack/sd-ggml")
|
| 41 |
os.chdir("sd-ggml")
|
|
|
|
| 16 |
'''
|
| 17 |
|
| 18 |
os.system("pip install huggingface_hub")
|
| 19 |
+
#### https://huggingface.co/svjack/sd-ggml-cpp-dp/resolve/main/models/Cyberpunk_Anime_Diffusion-ggml-model_q4_0.bin
|
| 20 |
+
def make_and_download_clean_dir(repo_name = "svjack/sd-ggml",
|
| 21 |
+
rp_tgt_tail_dict = {
|
| 22 |
+
"models": "wget https://huggingface.co/{}/resolve/main/{}/{}"
|
| 23 |
+
}
|
| 24 |
+
):
|
| 25 |
import shutil
|
| 26 |
import os
|
| 27 |
from tqdm import tqdm
|
|
|
|
| 38 |
src = path
|
| 39 |
tgt = src.split("/")[-1]
|
| 40 |
print("downloading {} to {}".format(src, tgt))
|
| 41 |
+
if tgt not in rp_tgt_tail_dict:
|
| 42 |
+
fs.download(
|
| 43 |
+
src, tgt, recursive = True
|
| 44 |
+
)
|
| 45 |
+
else:
|
| 46 |
+
tgt_cmd_format = rp_tgt_tail_dict[tgt]
|
| 47 |
+
os.mkdir(tgt)
|
| 48 |
+
os.chdir(tgt)
|
| 49 |
+
sub_fd_list = fs.ls(src, detail = False)
|
| 50 |
+
for sub_file in tqdm(sub_fd_list):
|
| 51 |
+
tgt_cmd = tgt_cmd_format.format(
|
| 52 |
+
repo_name, tgt, sub_file.split("/")[-1]
|
| 53 |
+
)
|
| 54 |
+
print("run {}".format(tgt_cmd))
|
| 55 |
+
os.system(tgt_cmd)
|
| 56 |
+
os.chdir("..")
|
| 57 |
os.chdir("..")
|
| 58 |
make_and_download_clean_dir("svjack/sd-ggml")
|
| 59 |
os.chdir("sd-ggml")
|