less waiting :3
Browse files
files_cells/notebooks/en/downloading_en.ipynb
CHANGED
@@ -34,8 +34,30 @@
|
|
34 |
"webui_path = os.getenv('WEBUI_PATH')\n",
|
35 |
"free_plan = os.getenv('FREE_PLAN')\n",
|
36 |
"\n",
|
37 |
-
"OLD_UI = os.getenv('SDW_OLD_UI')\n",
|
38 |
"UI = os.getenv('SDW_UI')\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
"\n",
|
40 |
"\n",
|
41 |
"# ================ LIBRARIES V2 ================\n",
|
@@ -45,11 +67,12 @@
|
|
45 |
" print(\"💿 Installing the libraries, it's going to take a while:\\n\")\n",
|
46 |
"\n",
|
47 |
" install_lib = {\n",
|
48 |
-
" \"aria2\": \"apt -y install aria2\",\n",
|
49 |
-
"
|
50 |
" \"localtunnel\": \"npm install -g localtunnel\",\n",
|
51 |
-
" \"insightface\": \"pip install insightface\"\n",
|
52 |
" }\n",
|
|
|
|
|
53 |
"\n",
|
54 |
" additional_libs = {\n",
|
55 |
" \"Google Colab\": {\n",
|
@@ -61,7 +84,6 @@
|
|
61 |
" # \"aiohttp\": \"pip install trash-cli && trash-put /opt/conda/lib/python3.10/site-packages/aiohttp*\" # fix install req\n",
|
62 |
" }\n",
|
63 |
" }\n",
|
64 |
-
"\n",
|
65 |
" if env in additional_libs:\n",
|
66 |
" install_lib.update(additional_libs[env])\n",
|
67 |
"\n",
|
@@ -88,28 +110,6 @@
|
|
88 |
" clear_output()\n",
|
89 |
"\n",
|
90 |
"\n",
|
91 |
-
"# ============ loading settings V4 =============\n",
|
92 |
-
"def load_settings(path):\n",
|
93 |
-
" if os.path.exists(path):\n",
|
94 |
-
" with open(path, 'r') as file:\n",
|
95 |
-
" return json.load(file)\n",
|
96 |
-
" return {}\n",
|
97 |
-
"\n",
|
98 |
-
"settings = load_settings(f'{root_path}/settings.json')\n",
|
99 |
-
"\n",
|
100 |
-
"VARIABLES = [\n",
|
101 |
-
" 'model', 'model_num', 'inpainting_model',\n",
|
102 |
-
" 'vae', 'vae_num', 'latest_webui', 'latest_exstensions',\n",
|
103 |
-
" 'change_webui', 'detailed_download', 'controlnet',\n",
|
104 |
-
" 'controlnet_num', 'commit_hash', 'huggingface_token',\n",
|
105 |
-
" 'ngrok_token', 'zrok_token', 'commandline_arguments',\n",
|
106 |
-
" 'Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url',\n",
|
107 |
-
" 'Extensions_url', 'custom_file_urls'\n",
|
108 |
-
"]\n",
|
109 |
-
"\n",
|
110 |
-
"locals().update({key: settings.get(key) for key in VARIABLES})\n",
|
111 |
-
"\n",
|
112 |
-
"\n",
|
113 |
"# =================== OTHER ====================\n",
|
114 |
"# Setup Timer\n",
|
115 |
"if \"START_COLAB\" in os.environ:\n",
|
@@ -413,13 +413,13 @@
|
|
413 |
" dir = PREFIXES[prefix]\n",
|
414 |
" if prefix != \"extension\":\n",
|
415 |
" try:\n",
|
416 |
-
" manual_download(path, dir, file_name=file_name)\n",
|
417 |
" except Exception as e:\n",
|
418 |
" print(f\"Error downloading file: {e}\")\n",
|
419 |
" else:\n",
|
420 |
" extension_repo.append((path, file_name))\n",
|
421 |
"\n",
|
422 |
-
"def manual_download(url, dst_dir, file_name):\n",
|
423 |
" header_option = f\"--header={user_header}\"\n",
|
424 |
" aria2c_header = \"--header='User-Agent: Mozilla/5.0' --allow-overwrite=true\"\n",
|
425 |
" aria2_args = \"--optimize-concurrent-downloads --console-log-level=error --summary-interval=10 --stderr=true -c -x16 -s16 -k1M -j5\"\n",
|
@@ -444,6 +444,10 @@
|
|
444 |
"\n",
|
445 |
" # =====================\n",
|
446 |
" def run_aria2c(url, dst_dir, file_name=None, args=\"\", header=\"\"):\n",
|
|
|
|
|
|
|
|
|
447 |
" out = f\"-o '{file_name}'\" if file_name else \"\"\n",
|
448 |
" !aria2c {header} {args} -d {dst_dir} {out} '{url}'\n",
|
449 |
"\n",
|
|
|
34 |
"webui_path = os.getenv('WEBUI_PATH')\n",
|
35 |
"free_plan = os.getenv('FREE_PLAN')\n",
|
36 |
"\n",
|
|
|
37 |
"UI = os.getenv('SDW_UI')\n",
|
38 |
+
"OLD_UI = os.getenv('SDW_OLD_UI')\n",
|
39 |
+
"\n",
|
40 |
+
"\n",
|
41 |
+
"# ============ loading settings V4 =============\n",
|
42 |
+
"def load_settings(path):\n",
|
43 |
+
" if os.path.exists(path):\n",
|
44 |
+
" with open(path, 'r') as file:\n",
|
45 |
+
" return json.load(file)\n",
|
46 |
+
" return {}\n",
|
47 |
+
"\n",
|
48 |
+
"settings = load_settings(f'{root_path}/settings.json')\n",
|
49 |
+
"\n",
|
50 |
+
"VARIABLES = [\n",
|
51 |
+
" 'model', 'model_num', 'inpainting_model',\n",
|
52 |
+
" 'vae', 'vae_num', 'latest_webui', 'latest_exstensions',\n",
|
53 |
+
" 'change_webui', 'detailed_download', 'controlnet',\n",
|
54 |
+
" 'controlnet_num', 'commit_hash', 'huggingface_token',\n",
|
55 |
+
" 'ngrok_token', 'zrok_token', 'commandline_arguments',\n",
|
56 |
+
" 'Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url',\n",
|
57 |
+
" 'Extensions_url', 'custom_file_urls'\n",
|
58 |
+
"]\n",
|
59 |
+
"\n",
|
60 |
+
"locals().update({key: settings.get(key) for key in VARIABLES})\n",
|
61 |
"\n",
|
62 |
"\n",
|
63 |
"# ================ LIBRARIES V2 ================\n",
|
|
|
67 |
" print(\"💿 Installing the libraries, it's going to take a while:\\n\")\n",
|
68 |
"\n",
|
69 |
" install_lib = {\n",
|
70 |
+
" # \"aria2\": \"apt -y install aria2\",\n",
|
71 |
+
" \"aria2\": \"pip install aria2\",\n",
|
72 |
" \"localtunnel\": \"npm install -g localtunnel\",\n",
|
|
|
73 |
" }\n",
|
74 |
+
" if controlnet != 'none':\n",
|
75 |
+
" install_lib[\"insightface\"] = \"pip install insightface\"\n",
|
76 |
"\n",
|
77 |
" additional_libs = {\n",
|
78 |
" \"Google Colab\": {\n",
|
|
|
84 |
" # \"aiohttp\": \"pip install trash-cli && trash-put /opt/conda/lib/python3.10/site-packages/aiohttp*\" # fix install req\n",
|
85 |
" }\n",
|
86 |
" }\n",
|
|
|
87 |
" if env in additional_libs:\n",
|
88 |
" install_lib.update(additional_libs[env])\n",
|
89 |
"\n",
|
|
|
110 |
" clear_output()\n",
|
111 |
"\n",
|
112 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
"# =================== OTHER ====================\n",
|
114 |
"# Setup Timer\n",
|
115 |
"if \"START_COLAB\" in os.environ:\n",
|
|
|
413 |
" dir = PREFIXES[prefix]\n",
|
414 |
" if prefix != \"extension\":\n",
|
415 |
" try:\n",
|
416 |
+
" manual_download(path, dir, file_name=file_name, prefix=prefix)\n",
|
417 |
" except Exception as e:\n",
|
418 |
" print(f\"Error downloading file: {e}\")\n",
|
419 |
" else:\n",
|
420 |
" extension_repo.append((path, file_name))\n",
|
421 |
"\n",
|
422 |
+
"def manual_download(url, dst_dir, file_name, prefix=None):\n",
|
423 |
" header_option = f\"--header={user_header}\"\n",
|
424 |
" aria2c_header = \"--header='User-Agent: Mozilla/5.0' --allow-overwrite=true\"\n",
|
425 |
" aria2_args = \"--optimize-concurrent-downloads --console-log-level=error --summary-interval=10 --stderr=true -c -x16 -s16 -k1M -j5\"\n",
|
|
|
444 |
"\n",
|
445 |
" # =====================\n",
|
446 |
" def run_aria2c(url, dst_dir, file_name=None, args=\"\", header=\"\"):\n",
|
447 |
+
" file_path = os.path.join(dst_dir, file_name) # replaces config files\n",
|
448 |
+
" if os.path.exists(file_path) and prefix == 'config':\n",
|
449 |
+
" os.remove(file_path)\n",
|
450 |
+
"\n",
|
451 |
" out = f\"-o '{file_name}'\" if file_name else \"\"\n",
|
452 |
" !aria2c {header} {args} -d {dst_dir} {out} '{url}'\n",
|
453 |
"\n",
|
files_cells/notebooks/ru/downloading_ru.ipynb
CHANGED
@@ -38,6 +38,28 @@
|
|
38 |
"OLD_UI = os.getenv('SDW_OLD_UI')\n",
|
39 |
"\n",
|
40 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
"# ================ LIBRARIES V2 ================\n",
|
42 |
"flag_file = f\"{root_path}/libraries_installed.txt\"\n",
|
43 |
"\n",
|
@@ -45,11 +67,12 @@
|
|
45 |
" print(\"💿 Установка библиотек, это займет какое-то время:\\n\")\n",
|
46 |
"\n",
|
47 |
" install_lib = {\n",
|
48 |
-
" \"aria2\": \"apt -y install aria2\",\n",
|
49 |
-
"
|
50 |
" \"localtunnel\": \"npm install -g localtunnel\",\n",
|
51 |
-
" \"insightface\": \"pip install insightface\"\n",
|
52 |
" }\n",
|
|
|
|
|
53 |
"\n",
|
54 |
" additional_libs = {\n",
|
55 |
" \"Google Colab\": {\n",
|
@@ -61,7 +84,6 @@
|
|
61 |
" # \"aiohttp\": \"pip install trash-cli && trash-put /opt/conda/lib/python3.10/site-packages/aiohttp*\" # fix install req\n",
|
62 |
" }\n",
|
63 |
" }\n",
|
64 |
-
"\n",
|
65 |
" if env in additional_libs:\n",
|
66 |
" install_lib.update(additional_libs[env])\n",
|
67 |
"\n",
|
@@ -88,28 +110,6 @@
|
|
88 |
" clear_output()\n",
|
89 |
"\n",
|
90 |
"\n",
|
91 |
-
"# ============ loading settings V4 =============\n",
|
92 |
-
"def load_settings(path):\n",
|
93 |
-
" if os.path.exists(path):\n",
|
94 |
-
" with open(path, 'r') as file:\n",
|
95 |
-
" return json.load(file)\n",
|
96 |
-
" return {}\n",
|
97 |
-
"\n",
|
98 |
-
"settings = load_settings(f'{root_path}/settings.json')\n",
|
99 |
-
"\n",
|
100 |
-
"VARIABLES = [\n",
|
101 |
-
" 'model', 'model_num', 'inpainting_model',\n",
|
102 |
-
" 'vae', 'vae_num', 'latest_webui', 'latest_exstensions',\n",
|
103 |
-
" 'change_webui', 'detailed_download', 'controlnet',\n",
|
104 |
-
" 'controlnet_num', 'commit_hash', 'huggingface_token',\n",
|
105 |
-
" 'ngrok_token', 'zrok_token', 'commandline_arguments',\n",
|
106 |
-
" 'Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url',\n",
|
107 |
-
" 'Extensions_url', 'custom_file_urls'\n",
|
108 |
-
"]\n",
|
109 |
-
"\n",
|
110 |
-
"locals().update({key: settings.get(key) for key in VARIABLES})\n",
|
111 |
-
"\n",
|
112 |
-
"\n",
|
113 |
"# =================== OTHER ====================\n",
|
114 |
"# Setup Timer\n",
|
115 |
"if \"START_COLAB\" in os.environ:\n",
|
@@ -413,13 +413,13 @@
|
|
413 |
" dir = PREFIXES[prefix]\n",
|
414 |
" if prefix != \"extension\":\n",
|
415 |
" try:\n",
|
416 |
-
" manual_download(path, dir, file_name=file_name)\n",
|
417 |
" except Exception as e:\n",
|
418 |
" print(f\"Error downloading file: {e}\")\n",
|
419 |
" else:\n",
|
420 |
" extension_repo.append((path, file_name))\n",
|
421 |
"\n",
|
422 |
-
"def manual_download(url, dst_dir, file_name):\n",
|
423 |
" header_option = f\"--header={user_header}\"\n",
|
424 |
" aria2c_header = \"--header='User-Agent: Mozilla/5.0' --allow-overwrite=true\"\n",
|
425 |
" aria2_args = \"--optimize-concurrent-downloads --console-log-level=error --summary-interval=10 --stderr=true -c -x16 -s16 -k1M -j5\"\n",
|
@@ -444,6 +444,10 @@
|
|
444 |
"\n",
|
445 |
" # =====================\n",
|
446 |
" def run_aria2c(url, dst_dir, file_name=None, args=\"\", header=\"\"):\n",
|
|
|
|
|
|
|
|
|
447 |
" out = f\"-o '{file_name}'\" if file_name else \"\"\n",
|
448 |
" !aria2c {header} {args} -d {dst_dir} {out} '{url}'\n",
|
449 |
"\n",
|
|
|
38 |
"OLD_UI = os.getenv('SDW_OLD_UI')\n",
|
39 |
"\n",
|
40 |
"\n",
|
41 |
+
"# ============ loading settings V4 =============\n",
|
42 |
+
"def load_settings(path):\n",
|
43 |
+
" if os.path.exists(path):\n",
|
44 |
+
" with open(path, 'r') as file:\n",
|
45 |
+
" return json.load(file)\n",
|
46 |
+
" return {}\n",
|
47 |
+
"\n",
|
48 |
+
"settings = load_settings(f'{root_path}/settings.json')\n",
|
49 |
+
"\n",
|
50 |
+
"VARIABLES = [\n",
|
51 |
+
" 'model', 'model_num', 'inpainting_model',\n",
|
52 |
+
" 'vae', 'vae_num', 'latest_webui', 'latest_exstensions',\n",
|
53 |
+
" 'change_webui', 'detailed_download', 'controlnet',\n",
|
54 |
+
" 'controlnet_num', 'commit_hash', 'huggingface_token',\n",
|
55 |
+
" 'ngrok_token', 'zrok_token', 'commandline_arguments',\n",
|
56 |
+
" 'Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url',\n",
|
57 |
+
" 'Extensions_url', 'custom_file_urls'\n",
|
58 |
+
"]\n",
|
59 |
+
"\n",
|
60 |
+
"locals().update({key: settings.get(key) for key in VARIABLES})\n",
|
61 |
+
"\n",
|
62 |
+
"\n",
|
63 |
"# ================ LIBRARIES V2 ================\n",
|
64 |
"flag_file = f\"{root_path}/libraries_installed.txt\"\n",
|
65 |
"\n",
|
|
|
67 |
" print(\"💿 Установка библиотек, это займет какое-то время:\\n\")\n",
|
68 |
"\n",
|
69 |
" install_lib = {\n",
|
70 |
+
" # \"aria2\": \"apt -y install aria2\",\n",
|
71 |
+
" \"aria2\": \"pip install aria2\",\n",
|
72 |
" \"localtunnel\": \"npm install -g localtunnel\",\n",
|
|
|
73 |
" }\n",
|
74 |
+
" if controlnet != 'none':\n",
|
75 |
+
" install_lib[\"insightface\"] = \"pip install insightface\"\n",
|
76 |
"\n",
|
77 |
" additional_libs = {\n",
|
78 |
" \"Google Colab\": {\n",
|
|
|
84 |
" # \"aiohttp\": \"pip install trash-cli && trash-put /opt/conda/lib/python3.10/site-packages/aiohttp*\" # fix install req\n",
|
85 |
" }\n",
|
86 |
" }\n",
|
|
|
87 |
" if env in additional_libs:\n",
|
88 |
" install_lib.update(additional_libs[env])\n",
|
89 |
"\n",
|
|
|
110 |
" clear_output()\n",
|
111 |
"\n",
|
112 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
"# =================== OTHER ====================\n",
|
114 |
"# Setup Timer\n",
|
115 |
"if \"START_COLAB\" in os.environ:\n",
|
|
|
413 |
" dir = PREFIXES[prefix]\n",
|
414 |
" if prefix != \"extension\":\n",
|
415 |
" try:\n",
|
416 |
+
" manual_download(path, dir, file_name=file_name, prefix=prefix)\n",
|
417 |
" except Exception as e:\n",
|
418 |
" print(f\"Error downloading file: {e}\")\n",
|
419 |
" else:\n",
|
420 |
" extension_repo.append((path, file_name))\n",
|
421 |
"\n",
|
422 |
+
"def manual_download(url, dst_dir, file_name, prefix=None):\n",
|
423 |
" header_option = f\"--header={user_header}\"\n",
|
424 |
" aria2c_header = \"--header='User-Agent: Mozilla/5.0' --allow-overwrite=true\"\n",
|
425 |
" aria2_args = \"--optimize-concurrent-downloads --console-log-level=error --summary-interval=10 --stderr=true -c -x16 -s16 -k1M -j5\"\n",
|
|
|
444 |
"\n",
|
445 |
" # =====================\n",
|
446 |
" def run_aria2c(url, dst_dir, file_name=None, args=\"\", header=\"\"):\n",
|
447 |
+
" file_path = os.path.join(dst_dir, file_name) # replaces config files\n",
|
448 |
+
" if os.path.exists(file_path) and prefix == 'config':\n",
|
449 |
+
" os.remove(file_path)\n",
|
450 |
+
"\n",
|
451 |
" out = f\"-o '{file_name}'\" if file_name else \"\"\n",
|
452 |
" !aria2c {header} {args} -d {dst_dir} {out} '{url}'\n",
|
453 |
"\n",
|
files_cells/python/en/downloading_en.py
CHANGED
@@ -24,8 +24,30 @@ root_path = os.getenv('ROOT_PATH')
|
|
24 |
webui_path = os.getenv('WEBUI_PATH')
|
25 |
free_plan = os.getenv('FREE_PLAN')
|
26 |
|
27 |
-
OLD_UI = os.getenv('SDW_OLD_UI')
|
28 |
UI = os.getenv('SDW_UI')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
|
31 |
# ================ LIBRARIES V2 ================
|
@@ -35,11 +57,12 @@ if not os.path.exists(flag_file):
|
|
35 |
print("💿 Installing the libraries, it's going to take a while:\n")
|
36 |
|
37 |
install_lib = {
|
38 |
-
"aria2": "apt -y install aria2",
|
39 |
-
|
40 |
"localtunnel": "npm install -g localtunnel",
|
41 |
-
"insightface": "pip install insightface"
|
42 |
}
|
|
|
|
|
43 |
|
44 |
additional_libs = {
|
45 |
"Google Colab": {
|
@@ -51,7 +74,6 @@ if not os.path.exists(flag_file):
|
|
51 |
# "aiohttp": "pip install trash-cli && trash-put /opt/conda/lib/python3.10/site-packages/aiohttp*" # fix install req
|
52 |
}
|
53 |
}
|
54 |
-
|
55 |
if env in additional_libs:
|
56 |
install_lib.update(additional_libs[env])
|
57 |
|
@@ -78,28 +100,6 @@ if not os.path.exists(flag_file):
|
|
78 |
clear_output()
|
79 |
|
80 |
|
81 |
-
# ============ loading settings V4 =============
|
82 |
-
def load_settings(path):
|
83 |
-
if os.path.exists(path):
|
84 |
-
with open(path, 'r') as file:
|
85 |
-
return json.load(file)
|
86 |
-
return {}
|
87 |
-
|
88 |
-
settings = load_settings(f'{root_path}/settings.json')
|
89 |
-
|
90 |
-
VARIABLES = [
|
91 |
-
'model', 'model_num', 'inpainting_model',
|
92 |
-
'vae', 'vae_num', 'latest_webui', 'latest_exstensions',
|
93 |
-
'change_webui', 'detailed_download', 'controlnet',
|
94 |
-
'controlnet_num', 'commit_hash', 'huggingface_token',
|
95 |
-
'ngrok_token', 'zrok_token', 'commandline_arguments',
|
96 |
-
'Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url',
|
97 |
-
'Extensions_url', 'custom_file_urls'
|
98 |
-
]
|
99 |
-
|
100 |
-
locals().update({key: settings.get(key) for key in VARIABLES})
|
101 |
-
|
102 |
-
|
103 |
# =================== OTHER ====================
|
104 |
# Setup Timer
|
105 |
if "START_COLAB" in os.environ:
|
@@ -403,13 +403,13 @@ def handle_manual(url):
|
|
403 |
dir = PREFIXES[prefix]
|
404 |
if prefix != "extension":
|
405 |
try:
|
406 |
-
manual_download(path, dir, file_name=file_name)
|
407 |
except Exception as e:
|
408 |
print(f"Error downloading file: {e}")
|
409 |
else:
|
410 |
extension_repo.append((path, file_name))
|
411 |
|
412 |
-
def manual_download(url, dst_dir, file_name):
|
413 |
header_option = f"--header={user_header}"
|
414 |
aria2c_header = "--header='User-Agent: Mozilla/5.0' --allow-overwrite=true"
|
415 |
aria2_args = "--optimize-concurrent-downloads --console-log-level=error --summary-interval=10 --stderr=true -c -x16 -s16 -k1M -j5"
|
@@ -434,6 +434,10 @@ def manual_download(url, dst_dir, file_name):
|
|
434 |
|
435 |
# =====================
|
436 |
def run_aria2c(url, dst_dir, file_name=None, args="", header=""):
|
|
|
|
|
|
|
|
|
437 |
out = f"-o '{file_name}'" if file_name else ""
|
438 |
get_ipython().system("aria2c {header} {args} -d {dst_dir} {out} '{url}'")
|
439 |
|
|
|
24 |
webui_path = os.getenv('WEBUI_PATH')
|
25 |
free_plan = os.getenv('FREE_PLAN')
|
26 |
|
|
|
27 |
UI = os.getenv('SDW_UI')
|
28 |
+
OLD_UI = os.getenv('SDW_OLD_UI')
|
29 |
+
|
30 |
+
|
31 |
+
# ============ loading settings V4 =============
|
32 |
+
def load_settings(path):
|
33 |
+
if os.path.exists(path):
|
34 |
+
with open(path, 'r') as file:
|
35 |
+
return json.load(file)
|
36 |
+
return {}
|
37 |
+
|
38 |
+
settings = load_settings(f'{root_path}/settings.json')
|
39 |
+
|
40 |
+
VARIABLES = [
|
41 |
+
'model', 'model_num', 'inpainting_model',
|
42 |
+
'vae', 'vae_num', 'latest_webui', 'latest_exstensions',
|
43 |
+
'change_webui', 'detailed_download', 'controlnet',
|
44 |
+
'controlnet_num', 'commit_hash', 'huggingface_token',
|
45 |
+
'ngrok_token', 'zrok_token', 'commandline_arguments',
|
46 |
+
'Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url',
|
47 |
+
'Extensions_url', 'custom_file_urls'
|
48 |
+
]
|
49 |
+
|
50 |
+
locals().update({key: settings.get(key) for key in VARIABLES})
|
51 |
|
52 |
|
53 |
# ================ LIBRARIES V2 ================
|
|
|
57 |
print("💿 Installing the libraries, it's going to take a while:\n")
|
58 |
|
59 |
install_lib = {
|
60 |
+
# "aria2": "apt -y install aria2",
|
61 |
+
"aria2": "pip install aria2",
|
62 |
"localtunnel": "npm install -g localtunnel",
|
|
|
63 |
}
|
64 |
+
if controlnet != 'none':
|
65 |
+
install_lib["insightface"] = "pip install insightface"
|
66 |
|
67 |
additional_libs = {
|
68 |
"Google Colab": {
|
|
|
74 |
# "aiohttp": "pip install trash-cli && trash-put /opt/conda/lib/python3.10/site-packages/aiohttp*" # fix install req
|
75 |
}
|
76 |
}
|
|
|
77 |
if env in additional_libs:
|
78 |
install_lib.update(additional_libs[env])
|
79 |
|
|
|
100 |
clear_output()
|
101 |
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
# =================== OTHER ====================
|
104 |
# Setup Timer
|
105 |
if "START_COLAB" in os.environ:
|
|
|
403 |
dir = PREFIXES[prefix]
|
404 |
if prefix != "extension":
|
405 |
try:
|
406 |
+
manual_download(path, dir, file_name=file_name, prefix=prefix)
|
407 |
except Exception as e:
|
408 |
print(f"Error downloading file: {e}")
|
409 |
else:
|
410 |
extension_repo.append((path, file_name))
|
411 |
|
412 |
+
def manual_download(url, dst_dir, file_name, prefix=None):
|
413 |
header_option = f"--header={user_header}"
|
414 |
aria2c_header = "--header='User-Agent: Mozilla/5.0' --allow-overwrite=true"
|
415 |
aria2_args = "--optimize-concurrent-downloads --console-log-level=error --summary-interval=10 --stderr=true -c -x16 -s16 -k1M -j5"
|
|
|
434 |
|
435 |
# =====================
|
436 |
def run_aria2c(url, dst_dir, file_name=None, args="", header=""):
|
437 |
+
file_path = os.path.join(dst_dir, file_name) # replaces config files
|
438 |
+
if os.path.exists(file_path) and prefix == 'config':
|
439 |
+
os.remove(file_path)
|
440 |
+
|
441 |
out = f"-o '{file_name}'" if file_name else ""
|
442 |
get_ipython().system("aria2c {header} {args} -d {dst_dir} {out} '{url}'")
|
443 |
|
files_cells/python/ru/downloading_ru.py
CHANGED
@@ -28,6 +28,28 @@ UI = os.getenv('SDW_UI')
|
|
28 |
OLD_UI = os.getenv('SDW_OLD_UI')
|
29 |
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
# ================ LIBRARIES V2 ================
|
32 |
flag_file = f"{root_path}/libraries_installed.txt"
|
33 |
|
@@ -35,11 +57,12 @@ if not os.path.exists(flag_file):
|
|
35 |
print("💿 Установка библиотек, это займет какое-то время:\n")
|
36 |
|
37 |
install_lib = {
|
38 |
-
"aria2": "apt -y install aria2",
|
39 |
-
|
40 |
"localtunnel": "npm install -g localtunnel",
|
41 |
-
"insightface": "pip install insightface"
|
42 |
}
|
|
|
|
|
43 |
|
44 |
additional_libs = {
|
45 |
"Google Colab": {
|
@@ -51,7 +74,6 @@ if not os.path.exists(flag_file):
|
|
51 |
# "aiohttp": "pip install trash-cli && trash-put /opt/conda/lib/python3.10/site-packages/aiohttp*" # fix install req
|
52 |
}
|
53 |
}
|
54 |
-
|
55 |
if env in additional_libs:
|
56 |
install_lib.update(additional_libs[env])
|
57 |
|
@@ -78,28 +100,6 @@ if not os.path.exists(flag_file):
|
|
78 |
clear_output()
|
79 |
|
80 |
|
81 |
-
# ============ loading settings V4 =============
|
82 |
-
def load_settings(path):
|
83 |
-
if os.path.exists(path):
|
84 |
-
with open(path, 'r') as file:
|
85 |
-
return json.load(file)
|
86 |
-
return {}
|
87 |
-
|
88 |
-
settings = load_settings(f'{root_path}/settings.json')
|
89 |
-
|
90 |
-
VARIABLES = [
|
91 |
-
'model', 'model_num', 'inpainting_model',
|
92 |
-
'vae', 'vae_num', 'latest_webui', 'latest_exstensions',
|
93 |
-
'change_webui', 'detailed_download', 'controlnet',
|
94 |
-
'controlnet_num', 'commit_hash', 'huggingface_token',
|
95 |
-
'ngrok_token', 'zrok_token', 'commandline_arguments',
|
96 |
-
'Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url',
|
97 |
-
'Extensions_url', 'custom_file_urls'
|
98 |
-
]
|
99 |
-
|
100 |
-
locals().update({key: settings.get(key) for key in VARIABLES})
|
101 |
-
|
102 |
-
|
103 |
# =================== OTHER ====================
|
104 |
# Setup Timer
|
105 |
if "START_COLAB" in os.environ:
|
@@ -403,13 +403,13 @@ def handle_manual(url):
|
|
403 |
dir = PREFIXES[prefix]
|
404 |
if prefix != "extension":
|
405 |
try:
|
406 |
-
manual_download(path, dir, file_name=file_name)
|
407 |
except Exception as e:
|
408 |
print(f"Error downloading file: {e}")
|
409 |
else:
|
410 |
extension_repo.append((path, file_name))
|
411 |
|
412 |
-
def manual_download(url, dst_dir, file_name):
|
413 |
header_option = f"--header={user_header}"
|
414 |
aria2c_header = "--header='User-Agent: Mozilla/5.0' --allow-overwrite=true"
|
415 |
aria2_args = "--optimize-concurrent-downloads --console-log-level=error --summary-interval=10 --stderr=true -c -x16 -s16 -k1M -j5"
|
@@ -434,6 +434,10 @@ def manual_download(url, dst_dir, file_name):
|
|
434 |
|
435 |
# =====================
|
436 |
def run_aria2c(url, dst_dir, file_name=None, args="", header=""):
|
|
|
|
|
|
|
|
|
437 |
out = f"-o '{file_name}'" if file_name else ""
|
438 |
get_ipython().system("aria2c {header} {args} -d {dst_dir} {out} '{url}'")
|
439 |
|
|
|
28 |
OLD_UI = os.getenv('SDW_OLD_UI')
|
29 |
|
30 |
|
31 |
+
# ============ loading settings V4 =============
|
32 |
+
def load_settings(path):
|
33 |
+
if os.path.exists(path):
|
34 |
+
with open(path, 'r') as file:
|
35 |
+
return json.load(file)
|
36 |
+
return {}
|
37 |
+
|
38 |
+
settings = load_settings(f'{root_path}/settings.json')
|
39 |
+
|
40 |
+
VARIABLES = [
|
41 |
+
'model', 'model_num', 'inpainting_model',
|
42 |
+
'vae', 'vae_num', 'latest_webui', 'latest_exstensions',
|
43 |
+
'change_webui', 'detailed_download', 'controlnet',
|
44 |
+
'controlnet_num', 'commit_hash', 'huggingface_token',
|
45 |
+
'ngrok_token', 'zrok_token', 'commandline_arguments',
|
46 |
+
'Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url',
|
47 |
+
'Extensions_url', 'custom_file_urls'
|
48 |
+
]
|
49 |
+
|
50 |
+
locals().update({key: settings.get(key) for key in VARIABLES})
|
51 |
+
|
52 |
+
|
53 |
# ================ LIBRARIES V2 ================
|
54 |
flag_file = f"{root_path}/libraries_installed.txt"
|
55 |
|
|
|
57 |
print("💿 Установка библиотек, это займет какое-то время:\n")
|
58 |
|
59 |
install_lib = {
|
60 |
+
# "aria2": "apt -y install aria2",
|
61 |
+
"aria2": "pip install aria2",
|
62 |
"localtunnel": "npm install -g localtunnel",
|
|
|
63 |
}
|
64 |
+
if controlnet != 'none':
|
65 |
+
install_lib["insightface"] = "pip install insightface"
|
66 |
|
67 |
additional_libs = {
|
68 |
"Google Colab": {
|
|
|
74 |
# "aiohttp": "pip install trash-cli && trash-put /opt/conda/lib/python3.10/site-packages/aiohttp*" # fix install req
|
75 |
}
|
76 |
}
|
|
|
77 |
if env in additional_libs:
|
78 |
install_lib.update(additional_libs[env])
|
79 |
|
|
|
100 |
clear_output()
|
101 |
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
# =================== OTHER ====================
|
104 |
# Setup Timer
|
105 |
if "START_COLAB" in os.environ:
|
|
|
403 |
dir = PREFIXES[prefix]
|
404 |
if prefix != "extension":
|
405 |
try:
|
406 |
+
manual_download(path, dir, file_name=file_name, prefix=prefix)
|
407 |
except Exception as e:
|
408 |
print(f"Error downloading file: {e}")
|
409 |
else:
|
410 |
extension_repo.append((path, file_name))
|
411 |
|
412 |
+
def manual_download(url, dst_dir, file_name, prefix=None):
|
413 |
header_option = f"--header={user_header}"
|
414 |
aria2c_header = "--header='User-Agent: Mozilla/5.0' --allow-overwrite=true"
|
415 |
aria2_args = "--optimize-concurrent-downloads --console-log-level=error --summary-interval=10 --stderr=true -c -x16 -s16 -k1M -j5"
|
|
|
434 |
|
435 |
# =====================
|
436 |
def run_aria2c(url, dst_dir, file_name=None, args="", header=""):
|
437 |
+
file_path = os.path.join(dst_dir, file_name) # replaces config files
|
438 |
+
if os.path.exists(file_path) and prefix == 'config':
|
439 |
+
os.remove(file_path)
|
440 |
+
|
441 |
out = f"-o '{file_name}'" if file_name else ""
|
442 |
get_ipython().system("aria2c {header} {args} -d {dst_dir} {out} '{url}'")
|
443 |
|