🚧 the latest tests--
Browse files- files_cells/notebooks/en/downloading_en.ipynb +14 -39
- files_cells/notebooks/en/widgets_en.ipynb +1 -4
- files_cells/notebooks/ru/downloading_ru.ipynb +15 -40
- files_cells/notebooks/ru/widgets_ru.ipynb +1 -4
- files_cells/python/en/downloading_en.py +13 -38
- files_cells/python/en/widgets_en.py +1 -4
- files_cells/python/ru/downloading_ru.py +14 -39
- files_cells/python/ru/widgets_ru.py +1 -4
files_cells/notebooks/en/downloading_en.ipynb
CHANGED
|
@@ -45,8 +45,8 @@
|
|
| 45 |
" print(\"💿 Installing the libraries, it's going to take a while:\\n\")\n",
|
| 46 |
"\n",
|
| 47 |
" install_lib = {\n",
|
| 48 |
-
"
|
| 49 |
-
" \"aria2\": \"pip install aria2\",\n",
|
| 50 |
" \"localtunnel\": \"npm install -g localtunnel\",\n",
|
| 51 |
" \"insightface\": \"pip install insightface\"\n",
|
| 52 |
" }\n",
|
|
@@ -119,26 +119,12 @@
|
|
| 119 |
" os.environ[\"START_COLAB\"] = str(start_colab)\n",
|
| 120 |
"\n",
|
| 121 |
"# remove directory func\n",
|
| 122 |
-
"def _remove_dir(directory_path
|
| 123 |
-
" if
|
| 124 |
-
" raise ValueError(\"The directory path is empty\")\n",
|
| 125 |
-
"\n",
|
| 126 |
-
" try:\n",
|
| 127 |
-
" subprocess.run(['rm', '-rf', directory_path], check=True, capture_output=True)\n",
|
| 128 |
-
" if log:\n",
|
| 129 |
-
" print(f\"Successfully executed: rm -rf {directory_path}\")\n",
|
| 130 |
-
" except subprocess.CalledProcessError as e:\n",
|
| 131 |
-
" if log:\n",
|
| 132 |
-
" print(f\"Failed to remove {directory_path} using rm -rf. Error: {e}\")\n",
|
| 133 |
-
"\n",
|
| 134 |
-
" if os.path.exists(directory_path):\n",
|
| 135 |
" try:\n",
|
| 136 |
" shutil.rmtree(directory_path)\n",
|
| 137 |
-
"
|
| 138 |
-
"
|
| 139 |
-
" except Exception as e:\n",
|
| 140 |
-
" if log:\n",
|
| 141 |
-
" print(f\"Failed to remove {directory_path} using shutil. Error: {e}\")\n",
|
| 142 |
"\n",
|
| 143 |
"# Save files temporarily\n",
|
| 144 |
"temporarily_dir = f'{root_path}/temp_dir'\n",
|
|
@@ -148,7 +134,8 @@
|
|
| 148 |
" 'embeddings',\n",
|
| 149 |
" 'models/Stable-diffusion',\n",
|
| 150 |
" 'models/VAE',\n",
|
| 151 |
-
" 'models/Lora'
|
|
|
|
| 152 |
" ]\n",
|
| 153 |
"\n",
|
| 154 |
" print(\"Moving files...\", end='')\n",
|
|
@@ -164,20 +151,11 @@
|
|
| 164 |
" shutil.move(src, dst)\n",
|
| 165 |
" print(\"\\r🔥 Files moved!\" + \" \"*15)\n",
|
| 166 |
"\n",
|
| 167 |
-
"def configure_environment():\n",
|
| 168 |
-
" os.chdir(root_path)\n",
|
| 169 |
-
" os.environ.update({\n",
|
| 170 |
-
" \"SAFETENSORS_FAST_GPU\": '1',\n",
|
| 171 |
-
" \"CUDA_MODULE_LOADING\": \"LAZY\",\n",
|
| 172 |
-
" \"TF_CPP_MIN_LOG_LEVEL\": \"3\",\n",
|
| 173 |
-
" \"PYTHONWARNINGS\": \"ignore\"\n",
|
| 174 |
-
" })\n",
|
| 175 |
-
"\n",
|
| 176 |
"def download_and_unpack(url, dest_path):\n",
|
| 177 |
-
" aria2_args = \"--
|
| 178 |
-
"
|
| 179 |
-
"
|
| 180 |
-
"
|
| 181 |
"\n",
|
| 182 |
"def handle_colab_timer(webui_path, timer_colab):\n",
|
| 183 |
" timer_file_path = os.path.join(webui_path, 'static', 'colabTimer.txt')\n",
|
|
@@ -199,7 +177,6 @@
|
|
| 199 |
" download_url = \"https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO_forge.zip\"\n",
|
| 200 |
"\n",
|
| 201 |
" download_and_unpack(download_url, webui_path)\n",
|
| 202 |
-
" configure_environment()\n",
|
| 203 |
"\n",
|
| 204 |
" get_ipython().system(f'echo -n {start_colab} > {webui_path}/static/colabTimer.txt')\n",
|
| 205 |
" del cap\n",
|
|
@@ -215,7 +192,7 @@
|
|
| 215 |
"# ================= MAIN CODE ==================\n",
|
| 216 |
"if os.path.exists(webui_path):\n",
|
| 217 |
" if UI != OLD_UI:\n",
|
| 218 |
-
" print(f'Switching the WebUI from \\033[33m{OLD_UI}\\033[0m to \\033[33m{UI}\\033[0m:\\n'
|
| 219 |
" copy_items_with_replace(webui_path, temporarily_dir)\n",
|
| 220 |
" _remove_dir(webui_path)\n",
|
| 221 |
" os.environ['SDW_OLD_UI'] = UI\n",
|
|
@@ -258,10 +235,8 @@
|
|
| 258 |
"with capture.capture_output() as cap:\n",
|
| 259 |
" # --- Umi-Wildcard ---\n",
|
| 260 |
" !sed -i '521s/open=\\(False\\|True\\)/open=False/' {webui_path}/extensions/Umi-AI-Wildcards/scripts/wildcard_recursive.py # Closed accordion by default\n",
|
| 261 |
-
"\n",
|
| 262 |
" # --- Encrypt-Image ---\n",
|
| 263 |
" !sed -i '9,37d' {webui_path}/extensions/Encrypt-Image/javascript/encrypt_images_info.js # Removes the weird text in webui\n",
|
| 264 |
-
"\n",
|
| 265 |
" # --- Additional-Networks ---\n",
|
| 266 |
" !wget -O {webui_path}/extensions/additional-networks/scripts/metadata_editor.py {anxety_repos}/extensions/Additional-Networks/fix/metadata_editor.py # Fixing an error due to old style\n",
|
| 267 |
"del cap\n",
|
|
@@ -463,7 +438,7 @@
|
|
| 463 |
" \"\"\" Formatted info output \"\"\"\n",
|
| 464 |
" model_name_or_basename = file_name if file_name else basename\n",
|
| 465 |
" try:\n",
|
| 466 |
-
" format_output(clean_url or url, dst_dir, model_name_or_basename,
|
| 467 |
" except UnboundLocalError:\n",
|
| 468 |
" format_output(clean_url or url, dst_dir, model_name_or_basename, None, None)\n",
|
| 469 |
"\n",
|
|
|
|
| 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 |
+
" # \"aria2\": \"pip install aria2\",\n",
|
| 50 |
" \"localtunnel\": \"npm install -g localtunnel\",\n",
|
| 51 |
" \"insightface\": \"pip install insightface\"\n",
|
| 52 |
" }\n",
|
|
|
|
| 119 |
" os.environ[\"START_COLAB\"] = str(start_colab)\n",
|
| 120 |
"\n",
|
| 121 |
"# remove directory func\n",
|
| 122 |
+
"def _remove_dir(directory_path):\n",
|
| 123 |
+
" if directory_path and os.path.exists(directory_path):\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
" try:\n",
|
| 125 |
" shutil.rmtree(directory_path)\n",
|
| 126 |
+
" except Exception:\n",
|
| 127 |
+
" !rm -rf {directory_path}\n",
|
|
|
|
|
|
|
|
|
|
| 128 |
"\n",
|
| 129 |
"# Save files temporarily\n",
|
| 130 |
"temporarily_dir = f'{root_path}/temp_dir'\n",
|
|
|
|
| 134 |
" 'embeddings',\n",
|
| 135 |
" 'models/Stable-diffusion',\n",
|
| 136 |
" 'models/VAE',\n",
|
| 137 |
+
" 'models/Lora',\n",
|
| 138 |
+
" 'models/ControlNet'\n",
|
| 139 |
" ]\n",
|
| 140 |
"\n",
|
| 141 |
" print(\"Moving files...\", end='')\n",
|
|
|
|
| 151 |
" shutil.move(src, dst)\n",
|
| 152 |
" print(\"\\r🔥 Files moved!\" + \" \"*15)\n",
|
| 153 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
"def download_and_unpack(url, dest_path):\n",
|
| 155 |
+
" aria2_args = \"--console-log-level=error -c -x 16 -s 16 -k 1M\"\n",
|
| 156 |
+
" !aria2c {aria2_args} '{url}' -o repo.zip\n",
|
| 157 |
+
" !unzip -q -o repo.zip -d {dest_path}\n",
|
| 158 |
+
" !rm -rf repo.zip\n",
|
| 159 |
"\n",
|
| 160 |
"def handle_colab_timer(webui_path, timer_colab):\n",
|
| 161 |
" timer_file_path = os.path.join(webui_path, 'static', 'colabTimer.txt')\n",
|
|
|
|
| 177 |
" download_url = \"https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO_forge.zip\"\n",
|
| 178 |
"\n",
|
| 179 |
" download_and_unpack(download_url, webui_path)\n",
|
|
|
|
| 180 |
"\n",
|
| 181 |
" get_ipython().system(f'echo -n {start_colab} > {webui_path}/static/colabTimer.txt')\n",
|
| 182 |
" del cap\n",
|
|
|
|
| 192 |
"# ================= MAIN CODE ==================\n",
|
| 193 |
"if os.path.exists(webui_path):\n",
|
| 194 |
" if UI != OLD_UI:\n",
|
| 195 |
+
" print(f'Switching the WebUI from \\033[33m{OLD_UI}\\033[0m to \\033[33m{UI}\\033[0m:\\n')\n",
|
| 196 |
" copy_items_with_replace(webui_path, temporarily_dir)\n",
|
| 197 |
" _remove_dir(webui_path)\n",
|
| 198 |
" os.environ['SDW_OLD_UI'] = UI\n",
|
|
|
|
| 235 |
"with capture.capture_output() as cap:\n",
|
| 236 |
" # --- Umi-Wildcard ---\n",
|
| 237 |
" !sed -i '521s/open=\\(False\\|True\\)/open=False/' {webui_path}/extensions/Umi-AI-Wildcards/scripts/wildcard_recursive.py # Closed accordion by default\n",
|
|
|
|
| 238 |
" # --- Encrypt-Image ---\n",
|
| 239 |
" !sed -i '9,37d' {webui_path}/extensions/Encrypt-Image/javascript/encrypt_images_info.js # Removes the weird text in webui\n",
|
|
|
|
| 240 |
" # --- Additional-Networks ---\n",
|
| 241 |
" !wget -O {webui_path}/extensions/additional-networks/scripts/metadata_editor.py {anxety_repos}/extensions/Additional-Networks/fix/metadata_editor.py # Fixing an error due to old style\n",
|
| 242 |
"del cap\n",
|
|
|
|
| 438 |
" \"\"\" Formatted info output \"\"\"\n",
|
| 439 |
" model_name_or_basename = file_name if file_name else basename\n",
|
| 440 |
" try:\n",
|
| 441 |
+
" format_output(clean_url or url, dst_dir, model_name_or_basename, image_name, image_url)\n",
|
| 442 |
" except UnboundLocalError:\n",
|
| 443 |
" format_output(clean_url or url, dst_dir, model_name_or_basename, None, None)\n",
|
| 444 |
"\n",
|
files_cells/notebooks/en/widgets_en.ipynb
CHANGED
|
@@ -305,13 +305,10 @@
|
|
| 305 |
" os.environ['SDW_OLD_UI'] = change_webui_widget\n",
|
| 306 |
"\n",
|
| 307 |
" UI = os.getenv('SDW_UI')\n",
|
| 308 |
-
" OLD_UI = os.getenv('SDW_OLD_UI')\n",
|
| 309 |
"\n",
|
| 310 |
" if UI != change_webui_widget:\n",
|
| 311 |
" os.environ['SDW_UI'] = change_webui_widget\n",
|
| 312 |
"\n",
|
| 313 |
-
" # print(f'Current UI: {os.getenv(\"SDW_UI\")}, Old UI: {os.getenv(\"SDW_OLD_UI\")}')\n",
|
| 314 |
-
"\n",
|
| 315 |
"\n",
|
| 316 |
"# ============ Load / Save - Settings V2 ============\n",
|
| 317 |
"SETTINGS_FILE = f'{root_path}/settings.json'\n",
|
|
@@ -346,8 +343,8 @@
|
|
| 346 |
" widgets.Widget.close_all()\n",
|
| 347 |
"\n",
|
| 348 |
"def save_data(button):\n",
|
| 349 |
-
" setup_webui(change_webui_widget.value)\n",
|
| 350 |
" save_settings()\n",
|
|
|
|
| 351 |
" hide_widgets()\n",
|
| 352 |
"\n",
|
| 353 |
"load_settings()\n",
|
|
|
|
| 305 |
" os.environ['SDW_OLD_UI'] = change_webui_widget\n",
|
| 306 |
"\n",
|
| 307 |
" UI = os.getenv('SDW_UI')\n",
|
|
|
|
| 308 |
"\n",
|
| 309 |
" if UI != change_webui_widget:\n",
|
| 310 |
" os.environ['SDW_UI'] = change_webui_widget\n",
|
| 311 |
"\n",
|
|
|
|
|
|
|
| 312 |
"\n",
|
| 313 |
"# ============ Load / Save - Settings V2 ============\n",
|
| 314 |
"SETTINGS_FILE = f'{root_path}/settings.json'\n",
|
|
|
|
| 343 |
" widgets.Widget.close_all()\n",
|
| 344 |
"\n",
|
| 345 |
"def save_data(button):\n",
|
|
|
|
| 346 |
" save_settings()\n",
|
| 347 |
+
" setup_webui(change_webui_widget.value)\n",
|
| 348 |
" hide_widgets()\n",
|
| 349 |
"\n",
|
| 350 |
"load_settings()\n",
|
files_cells/notebooks/ru/downloading_ru.ipynb
CHANGED
|
@@ -34,8 +34,8 @@
|
|
| 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,8 +45,8 @@
|
|
| 45 |
" print(\"💿 Установка библиотек, это займет какое-то время:\\n\")\n",
|
| 46 |
"\n",
|
| 47 |
" install_lib = {\n",
|
| 48 |
-
"
|
| 49 |
-
" \"aria2\": \"pip install aria2\",\n",
|
| 50 |
" \"localtunnel\": \"npm install -g localtunnel\",\n",
|
| 51 |
" \"insightface\": \"pip install insightface\"\n",
|
| 52 |
" }\n",
|
|
@@ -119,26 +119,12 @@
|
|
| 119 |
" os.environ[\"START_COLAB\"] = str(start_colab)\n",
|
| 120 |
"\n",
|
| 121 |
"# remove directory func\n",
|
| 122 |
-
"def _remove_dir(directory_path
|
| 123 |
-
" if
|
| 124 |
-
" raise ValueError(\"The directory path is empty\")\n",
|
| 125 |
-
"\n",
|
| 126 |
-
" try:\n",
|
| 127 |
-
" subprocess.run(['rm', '-rf', directory_path], check=True, capture_output=True)\n",
|
| 128 |
-
" if log:\n",
|
| 129 |
-
" print(f\"Successfully executed: rm -rf {directory_path}\")\n",
|
| 130 |
-
" except subprocess.CalledProcessError as e:\n",
|
| 131 |
-
" if log:\n",
|
| 132 |
-
" print(f\"Failed to remove {directory_path} using rm -rf. Error: {e}\")\n",
|
| 133 |
-
"\n",
|
| 134 |
-
" if os.path.exists(directory_path):\n",
|
| 135 |
" try:\n",
|
| 136 |
" shutil.rmtree(directory_path)\n",
|
| 137 |
-
"
|
| 138 |
-
"
|
| 139 |
-
" except Exception as e:\n",
|
| 140 |
-
" if log:\n",
|
| 141 |
-
" print(f\"Failed to remove {directory_path} using shutil. Error: {e}\")\n",
|
| 142 |
"\n",
|
| 143 |
"# Save files temporarily\n",
|
| 144 |
"temporarily_dir = f'{root_path}/temp_dir'\n",
|
|
@@ -148,7 +134,8 @@
|
|
| 148 |
" 'embeddings',\n",
|
| 149 |
" 'models/Stable-diffusion',\n",
|
| 150 |
" 'models/VAE',\n",
|
| 151 |
-
" 'models/Lora'
|
|
|
|
| 152 |
" ]\n",
|
| 153 |
"\n",
|
| 154 |
" print(\"Перемещение файлов...\", end='')\n",
|
|
@@ -164,20 +151,11 @@
|
|
| 164 |
" shutil.move(src, dst)\n",
|
| 165 |
" print(\"\\r🔥 Файлы перемещены!\" + \" \"*15)\n",
|
| 166 |
"\n",
|
| 167 |
-
"def configure_environment():\n",
|
| 168 |
-
" os.chdir(root_path)\n",
|
| 169 |
-
" os.environ.update({\n",
|
| 170 |
-
" \"SAFETENSORS_FAST_GPU\": '1',\n",
|
| 171 |
-
" \"CUDA_MODULE_LOADING\": \"LAZY\",\n",
|
| 172 |
-
" \"TF_CPP_MIN_LOG_LEVEL\": \"3\",\n",
|
| 173 |
-
" \"PYTHONWARNINGS\": \"ignore\"\n",
|
| 174 |
-
" })\n",
|
| 175 |
-
"\n",
|
| 176 |
"def download_and_unpack(url, dest_path):\n",
|
| 177 |
-
" aria2_args = \"--
|
| 178 |
-
"
|
| 179 |
-
"
|
| 180 |
-
"
|
| 181 |
"\n",
|
| 182 |
"def handle_colab_timer(webui_path, timer_colab):\n",
|
| 183 |
" timer_file_path = os.path.join(webui_path, 'static', 'colabTimer.txt')\n",
|
|
@@ -199,7 +177,6 @@
|
|
| 199 |
" download_url = \"https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO_forge.zip\"\n",
|
| 200 |
"\n",
|
| 201 |
" download_and_unpack(download_url, webui_path)\n",
|
| 202 |
-
" configure_environment()\n",
|
| 203 |
"\n",
|
| 204 |
" get_ipython().system(f'echo -n {start_colab} > {webui_path}/static/colabTimer.txt')\n",
|
| 205 |
" del cap\n",
|
|
@@ -215,7 +192,7 @@
|
|
| 215 |
"# ================= MAIN CODE ==================\n",
|
| 216 |
"if os.path.exists(webui_path):\n",
|
| 217 |
" if UI != OLD_UI:\n",
|
| 218 |
-
" print(f'Переключение веб-интерфейса с \\033[33m{OLD_UI}\\033[0m на \\033[33m{UI}\\033[0m:\\n'
|
| 219 |
" copy_items_with_replace(webui_path, temporarily_dir)\n",
|
| 220 |
" _remove_dir(webui_path)\n",
|
| 221 |
" os.environ['SDW_OLD_UI'] = UI\n",
|
|
@@ -258,10 +235,8 @@
|
|
| 258 |
"with capture.capture_output() as cap:\n",
|
| 259 |
" # --- Umi-Wildcard ---\n",
|
| 260 |
" !sed -i '521s/open=\\(False\\|True\\)/open=False/' {webui_path}/extensions/Umi-AI-Wildcards/scripts/wildcard_recursive.py # Closed accordion by default\n",
|
| 261 |
-
"\n",
|
| 262 |
" # --- Encrypt-Image ---\n",
|
| 263 |
" !sed -i '9,37d' {webui_path}/extensions/Encrypt-Image/javascript/encrypt_images_info.js # Removes the weird text in webui\n",
|
| 264 |
-
"\n",
|
| 265 |
" # --- Additional-Networks ---\n",
|
| 266 |
" !wget -O {webui_path}/extensions/additional-networks/scripts/metadata_editor.py {anxety_repos}/extensions/Additional-Networks/fix/metadata_editor.py # Fixing an error due to old style\n",
|
| 267 |
"del cap\n",
|
|
@@ -463,7 +438,7 @@
|
|
| 463 |
" \"\"\" Formatted info output \"\"\"\n",
|
| 464 |
" model_name_or_basename = file_name if file_name else basename\n",
|
| 465 |
" try:\n",
|
| 466 |
-
" format_output(clean_url or url, dst_dir, model_name_or_basename,
|
| 467 |
" except UnboundLocalError:\n",
|
| 468 |
" format_output(clean_url or url, dst_dir, model_name_or_basename, None, None)\n",
|
| 469 |
"\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 |
"# ================ LIBRARIES V2 ================\n",
|
|
|
|
| 45 |
" print(\"💿 Установка библиотек, это займет какое-то время:\\n\")\n",
|
| 46 |
"\n",
|
| 47 |
" install_lib = {\n",
|
| 48 |
+
" \"aria2\": \"apt -y install aria2\",\n",
|
| 49 |
+
" # \"aria2\": \"pip install aria2\",\n",
|
| 50 |
" \"localtunnel\": \"npm install -g localtunnel\",\n",
|
| 51 |
" \"insightface\": \"pip install insightface\"\n",
|
| 52 |
" }\n",
|
|
|
|
| 119 |
" os.environ[\"START_COLAB\"] = str(start_colab)\n",
|
| 120 |
"\n",
|
| 121 |
"# remove directory func\n",
|
| 122 |
+
"def _remove_dir(directory_path):\n",
|
| 123 |
+
" if directory_path and os.path.exists(directory_path):\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
" try:\n",
|
| 125 |
" shutil.rmtree(directory_path)\n",
|
| 126 |
+
" except Exception:\n",
|
| 127 |
+
" !rm -rf {directory_path}\n",
|
|
|
|
|
|
|
|
|
|
| 128 |
"\n",
|
| 129 |
"# Save files temporarily\n",
|
| 130 |
"temporarily_dir = f'{root_path}/temp_dir'\n",
|
|
|
|
| 134 |
" 'embeddings',\n",
|
| 135 |
" 'models/Stable-diffusion',\n",
|
| 136 |
" 'models/VAE',\n",
|
| 137 |
+
" 'models/Lora',\n",
|
| 138 |
+
" 'models/ControlNet'\n",
|
| 139 |
" ]\n",
|
| 140 |
"\n",
|
| 141 |
" print(\"Перемещение файлов...\", end='')\n",
|
|
|
|
| 151 |
" shutil.move(src, dst)\n",
|
| 152 |
" print(\"\\r🔥 Файлы перемещены!\" + \" \"*15)\n",
|
| 153 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
"def download_and_unpack(url, dest_path):\n",
|
| 155 |
+
" aria2_args = \"--console-log-level=error -c -x 16 -s 16 -k 1M\"\n",
|
| 156 |
+
" !aria2c {aria2_args} '{url}' -o repo.zip\n",
|
| 157 |
+
" !unzip -q -o repo.zip -d {dest_path}\n",
|
| 158 |
+
" !rm -rf repo.zip\n",
|
| 159 |
"\n",
|
| 160 |
"def handle_colab_timer(webui_path, timer_colab):\n",
|
| 161 |
" timer_file_path = os.path.join(webui_path, 'static', 'colabTimer.txt')\n",
|
|
|
|
| 177 |
" download_url = \"https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO_forge.zip\"\n",
|
| 178 |
"\n",
|
| 179 |
" download_and_unpack(download_url, webui_path)\n",
|
|
|
|
| 180 |
"\n",
|
| 181 |
" get_ipython().system(f'echo -n {start_colab} > {webui_path}/static/colabTimer.txt')\n",
|
| 182 |
" del cap\n",
|
|
|
|
| 192 |
"# ================= MAIN CODE ==================\n",
|
| 193 |
"if os.path.exists(webui_path):\n",
|
| 194 |
" if UI != OLD_UI:\n",
|
| 195 |
+
" print(f'Переключение веб-интерфейса с \\033[33m{OLD_UI}\\033[0m на \\033[33m{UI}\\033[0m:\\n')\n",
|
| 196 |
" copy_items_with_replace(webui_path, temporarily_dir)\n",
|
| 197 |
" _remove_dir(webui_path)\n",
|
| 198 |
" os.environ['SDW_OLD_UI'] = UI\n",
|
|
|
|
| 235 |
"with capture.capture_output() as cap:\n",
|
| 236 |
" # --- Umi-Wildcard ---\n",
|
| 237 |
" !sed -i '521s/open=\\(False\\|True\\)/open=False/' {webui_path}/extensions/Umi-AI-Wildcards/scripts/wildcard_recursive.py # Closed accordion by default\n",
|
|
|
|
| 238 |
" # --- Encrypt-Image ---\n",
|
| 239 |
" !sed -i '9,37d' {webui_path}/extensions/Encrypt-Image/javascript/encrypt_images_info.js # Removes the weird text in webui\n",
|
|
|
|
| 240 |
" # --- Additional-Networks ---\n",
|
| 241 |
" !wget -O {webui_path}/extensions/additional-networks/scripts/metadata_editor.py {anxety_repos}/extensions/Additional-Networks/fix/metadata_editor.py # Fixing an error due to old style\n",
|
| 242 |
"del cap\n",
|
|
|
|
| 438 |
" \"\"\" Formatted info output \"\"\"\n",
|
| 439 |
" model_name_or_basename = file_name if file_name else basename\n",
|
| 440 |
" try:\n",
|
| 441 |
+
" format_output(clean_url or url, dst_dir, model_name_or_basename, image_name, image_url)\n",
|
| 442 |
" except UnboundLocalError:\n",
|
| 443 |
" format_output(clean_url or url, dst_dir, model_name_or_basename, None, None)\n",
|
| 444 |
"\n",
|
files_cells/notebooks/ru/widgets_ru.ipynb
CHANGED
|
@@ -305,13 +305,10 @@
|
|
| 305 |
" os.environ['SDW_OLD_UI'] = change_webui_widget\n",
|
| 306 |
"\n",
|
| 307 |
" UI = os.getenv('SDW_UI')\n",
|
| 308 |
-
" OLD_UI = os.getenv('SDW_OLD_UI')\n",
|
| 309 |
"\n",
|
| 310 |
" if UI != change_webui_widget:\n",
|
| 311 |
" os.environ['SDW_UI'] = change_webui_widget\n",
|
| 312 |
"\n",
|
| 313 |
-
" # print(f'Current UI: {os.getenv(\"SDW_UI\")}, Old UI: {os.getenv(\"SDW_OLD_UI\")}')\n",
|
| 314 |
-
"\n",
|
| 315 |
"\n",
|
| 316 |
"# ============ Load / Save - Settings V2 ============\n",
|
| 317 |
"SETTINGS_FILE = f'{root_path}/settings.json'\n",
|
|
@@ -346,8 +343,8 @@
|
|
| 346 |
" widgets.Widget.close_all()\n",
|
| 347 |
"\n",
|
| 348 |
"def save_data(button):\n",
|
| 349 |
-
" setup_webui(change_webui_widget.value)\n",
|
| 350 |
" save_settings()\n",
|
|
|
|
| 351 |
" hide_widgets()\n",
|
| 352 |
"\n",
|
| 353 |
"load_settings()\n",
|
|
|
|
| 305 |
" os.environ['SDW_OLD_UI'] = change_webui_widget\n",
|
| 306 |
"\n",
|
| 307 |
" UI = os.getenv('SDW_UI')\n",
|
|
|
|
| 308 |
"\n",
|
| 309 |
" if UI != change_webui_widget:\n",
|
| 310 |
" os.environ['SDW_UI'] = change_webui_widget\n",
|
| 311 |
"\n",
|
|
|
|
|
|
|
| 312 |
"\n",
|
| 313 |
"# ============ Load / Save - Settings V2 ============\n",
|
| 314 |
"SETTINGS_FILE = f'{root_path}/settings.json'\n",
|
|
|
|
| 343 |
" widgets.Widget.close_all()\n",
|
| 344 |
"\n",
|
| 345 |
"def save_data(button):\n",
|
|
|
|
| 346 |
" save_settings()\n",
|
| 347 |
+
" setup_webui(change_webui_widget.value)\n",
|
| 348 |
" hide_widgets()\n",
|
| 349 |
"\n",
|
| 350 |
"load_settings()\n",
|
files_cells/python/en/downloading_en.py
CHANGED
|
@@ -35,8 +35,8 @@ 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 |
-
|
| 39 |
-
"aria2": "pip install aria2",
|
| 40 |
"localtunnel": "npm install -g localtunnel",
|
| 41 |
"insightface": "pip install insightface"
|
| 42 |
}
|
|
@@ -109,26 +109,12 @@ else:
|
|
| 109 |
os.environ["START_COLAB"] = str(start_colab)
|
| 110 |
|
| 111 |
# remove directory func
|
| 112 |
-
def _remove_dir(directory_path
|
| 113 |
-
if
|
| 114 |
-
raise ValueError("The directory path is empty")
|
| 115 |
-
|
| 116 |
-
try:
|
| 117 |
-
subprocess.run(['rm', '-rf', directory_path], check=True, capture_output=True)
|
| 118 |
-
if log:
|
| 119 |
-
print(f"Successfully executed: rm -rf {directory_path}")
|
| 120 |
-
except subprocess.CalledProcessError as e:
|
| 121 |
-
if log:
|
| 122 |
-
print(f"Failed to remove {directory_path} using rm -rf. Error: {e}")
|
| 123 |
-
|
| 124 |
-
if os.path.exists(directory_path):
|
| 125 |
try:
|
| 126 |
shutil.rmtree(directory_path)
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
except Exception as e:
|
| 130 |
-
if log:
|
| 131 |
-
print(f"Failed to remove {directory_path} using shutil. Error: {e}")
|
| 132 |
|
| 133 |
# Save files temporarily
|
| 134 |
temporarily_dir = f'{root_path}/temp_dir'
|
|
@@ -138,7 +124,8 @@ def copy_items_with_replace(src_base, dst_base):
|
|
| 138 |
'embeddings',
|
| 139 |
'models/Stable-diffusion',
|
| 140 |
'models/VAE',
|
| 141 |
-
'models/Lora'
|
|
|
|
| 142 |
]
|
| 143 |
|
| 144 |
print("Moving files...", end='')
|
|
@@ -154,19 +141,10 @@ def copy_items_with_replace(src_base, dst_base):
|
|
| 154 |
shutil.move(src, dst)
|
| 155 |
print("\r🔥 Files moved!" + " "*15)
|
| 156 |
|
| 157 |
-
def configure_environment():
|
| 158 |
-
os.chdir(root_path)
|
| 159 |
-
os.environ.update({
|
| 160 |
-
"SAFETENSORS_FAST_GPU": '1',
|
| 161 |
-
"CUDA_MODULE_LOADING": "LAZY",
|
| 162 |
-
"TF_CPP_MIN_LOG_LEVEL": "3",
|
| 163 |
-
"PYTHONWARNINGS": "ignore"
|
| 164 |
-
})
|
| 165 |
-
|
| 166 |
def download_and_unpack(url, dest_path):
|
| 167 |
-
aria2_args = "--
|
| 168 |
-
get_ipython().system(
|
| 169 |
-
get_ipython().system(
|
| 170 |
get_ipython().system('rm -rf repo.zip')
|
| 171 |
|
| 172 |
def handle_colab_timer(webui_path, timer_colab):
|
|
@@ -189,7 +167,6 @@ def unpack_webui():
|
|
| 189 |
download_url = "https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO_forge.zip"
|
| 190 |
|
| 191 |
download_and_unpack(download_url, webui_path)
|
| 192 |
-
configure_environment()
|
| 193 |
|
| 194 |
get_ipython().system(f'echo -n {start_colab} > {webui_path}/static/colabTimer.txt')
|
| 195 |
del cap
|
|
@@ -205,7 +182,7 @@ def unpack_webui():
|
|
| 205 |
# ================= MAIN CODE ==================
|
| 206 |
if os.path.exists(webui_path):
|
| 207 |
if UI != OLD_UI:
|
| 208 |
-
print(f'Switching the WebUI from \033[33m{OLD_UI}\033[0m to \033[33m{UI}\033[0m:\n'
|
| 209 |
copy_items_with_replace(webui_path, temporarily_dir)
|
| 210 |
_remove_dir(webui_path)
|
| 211 |
os.environ['SDW_OLD_UI'] = UI
|
|
@@ -248,10 +225,8 @@ anxety_repos = "https://huggingface.co/NagisaNao/fast_repo/resolve/main"
|
|
| 248 |
with capture.capture_output() as cap:
|
| 249 |
# --- Umi-Wildcard ---
|
| 250 |
get_ipython().system("sed -i '521s/open=\\(False\\|True\\)/open=False/' {webui_path}/extensions/Umi-AI-Wildcards/scripts/wildcard_recursive.py # Closed accordion by default")
|
| 251 |
-
|
| 252 |
# --- Encrypt-Image ---
|
| 253 |
get_ipython().system("sed -i '9,37d' {webui_path}/extensions/Encrypt-Image/javascript/encrypt_images_info.js # Removes the weird text in webui")
|
| 254 |
-
|
| 255 |
# --- Additional-Networks ---
|
| 256 |
get_ipython().system('wget -O {webui_path}/extensions/additional-networks/scripts/metadata_editor.py {anxety_repos}/extensions/Additional-Networks/fix/metadata_editor.py # Fixing an error due to old style')
|
| 257 |
del cap
|
|
@@ -453,7 +428,7 @@ def manual_download(url, dst_dir, file_name):
|
|
| 453 |
""" Formatted info output """
|
| 454 |
model_name_or_basename = file_name if file_name else basename
|
| 455 |
try:
|
| 456 |
-
format_output(clean_url or url, dst_dir, model_name_or_basename,
|
| 457 |
except UnboundLocalError:
|
| 458 |
format_output(clean_url or url, dst_dir, model_name_or_basename, None, None)
|
| 459 |
|
|
|
|
| 35 |
print("💿 Installing the libraries, it's going to take a while:\n")
|
| 36 |
|
| 37 |
install_lib = {
|
| 38 |
+
"aria2": "apt -y install aria2",
|
| 39 |
+
# "aria2": "pip install aria2",
|
| 40 |
"localtunnel": "npm install -g localtunnel",
|
| 41 |
"insightface": "pip install insightface"
|
| 42 |
}
|
|
|
|
| 109 |
os.environ["START_COLAB"] = str(start_colab)
|
| 110 |
|
| 111 |
# remove directory func
|
| 112 |
+
def _remove_dir(directory_path):
|
| 113 |
+
if directory_path and os.path.exists(directory_path):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
try:
|
| 115 |
shutil.rmtree(directory_path)
|
| 116 |
+
except Exception:
|
| 117 |
+
get_ipython().system('rm -rf {directory_path}')
|
|
|
|
|
|
|
|
|
|
| 118 |
|
| 119 |
# Save files temporarily
|
| 120 |
temporarily_dir = f'{root_path}/temp_dir'
|
|
|
|
| 124 |
'embeddings',
|
| 125 |
'models/Stable-diffusion',
|
| 126 |
'models/VAE',
|
| 127 |
+
'models/Lora',
|
| 128 |
+
'models/ControlNet'
|
| 129 |
]
|
| 130 |
|
| 131 |
print("Moving files...", end='')
|
|
|
|
| 141 |
shutil.move(src, dst)
|
| 142 |
print("\r🔥 Files moved!" + " "*15)
|
| 143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
def download_and_unpack(url, dest_path):
|
| 145 |
+
aria2_args = "--console-log-level=error -c -x 16 -s 16 -k 1M"
|
| 146 |
+
get_ipython().system("aria2c {aria2_args} '{url}' -o repo.zip")
|
| 147 |
+
get_ipython().system('unzip -q -o repo.zip -d {dest_path}')
|
| 148 |
get_ipython().system('rm -rf repo.zip')
|
| 149 |
|
| 150 |
def handle_colab_timer(webui_path, timer_colab):
|
|
|
|
| 167 |
download_url = "https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO_forge.zip"
|
| 168 |
|
| 169 |
download_and_unpack(download_url, webui_path)
|
|
|
|
| 170 |
|
| 171 |
get_ipython().system(f'echo -n {start_colab} > {webui_path}/static/colabTimer.txt')
|
| 172 |
del cap
|
|
|
|
| 182 |
# ================= MAIN CODE ==================
|
| 183 |
if os.path.exists(webui_path):
|
| 184 |
if UI != OLD_UI:
|
| 185 |
+
print(f'Switching the WebUI from \033[33m{OLD_UI}\033[0m to \033[33m{UI}\033[0m:\n')
|
| 186 |
copy_items_with_replace(webui_path, temporarily_dir)
|
| 187 |
_remove_dir(webui_path)
|
| 188 |
os.environ['SDW_OLD_UI'] = UI
|
|
|
|
| 225 |
with capture.capture_output() as cap:
|
| 226 |
# --- Umi-Wildcard ---
|
| 227 |
get_ipython().system("sed -i '521s/open=\\(False\\|True\\)/open=False/' {webui_path}/extensions/Umi-AI-Wildcards/scripts/wildcard_recursive.py # Closed accordion by default")
|
|
|
|
| 228 |
# --- Encrypt-Image ---
|
| 229 |
get_ipython().system("sed -i '9,37d' {webui_path}/extensions/Encrypt-Image/javascript/encrypt_images_info.js # Removes the weird text in webui")
|
|
|
|
| 230 |
# --- Additional-Networks ---
|
| 231 |
get_ipython().system('wget -O {webui_path}/extensions/additional-networks/scripts/metadata_editor.py {anxety_repos}/extensions/Additional-Networks/fix/metadata_editor.py # Fixing an error due to old style')
|
| 232 |
del cap
|
|
|
|
| 428 |
""" Formatted info output """
|
| 429 |
model_name_or_basename = file_name if file_name else basename
|
| 430 |
try:
|
| 431 |
+
format_output(clean_url or url, dst_dir, model_name_or_basename, image_name, image_url)
|
| 432 |
except UnboundLocalError:
|
| 433 |
format_output(clean_url or url, dst_dir, model_name_or_basename, None, None)
|
| 434 |
|
files_cells/python/en/widgets_en.py
CHANGED
|
@@ -281,13 +281,10 @@ def setup_webui(change_webui_widget):
|
|
| 281 |
os.environ['SDW_OLD_UI'] = change_webui_widget
|
| 282 |
|
| 283 |
UI = os.getenv('SDW_UI')
|
| 284 |
-
OLD_UI = os.getenv('SDW_OLD_UI')
|
| 285 |
|
| 286 |
if UI != change_webui_widget:
|
| 287 |
os.environ['SDW_UI'] = change_webui_widget
|
| 288 |
|
| 289 |
-
# print(f'Current UI: {os.getenv("SDW_UI")}, Old UI: {os.getenv("SDW_OLD_UI")}')
|
| 290 |
-
|
| 291 |
|
| 292 |
# ============ Load / Save - Settings V2 ============
|
| 293 |
SETTINGS_FILE = f'{root_path}/settings.json'
|
|
@@ -322,8 +319,8 @@ def hide_widgets():
|
|
| 322 |
widgets.Widget.close_all()
|
| 323 |
|
| 324 |
def save_data(button):
|
| 325 |
-
setup_webui(change_webui_widget.value)
|
| 326 |
save_settings()
|
|
|
|
| 327 |
hide_widgets()
|
| 328 |
|
| 329 |
load_settings()
|
|
|
|
| 281 |
os.environ['SDW_OLD_UI'] = change_webui_widget
|
| 282 |
|
| 283 |
UI = os.getenv('SDW_UI')
|
|
|
|
| 284 |
|
| 285 |
if UI != change_webui_widget:
|
| 286 |
os.environ['SDW_UI'] = change_webui_widget
|
| 287 |
|
|
|
|
|
|
|
| 288 |
|
| 289 |
# ============ Load / Save - Settings V2 ============
|
| 290 |
SETTINGS_FILE = f'{root_path}/settings.json'
|
|
|
|
| 319 |
widgets.Widget.close_all()
|
| 320 |
|
| 321 |
def save_data(button):
|
|
|
|
| 322 |
save_settings()
|
| 323 |
+
setup_webui(change_webui_widget.value)
|
| 324 |
hide_widgets()
|
| 325 |
|
| 326 |
load_settings()
|
files_cells/python/ru/downloading_ru.py
CHANGED
|
@@ -24,8 +24,8 @@ 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,8 +35,8 @@ if not os.path.exists(flag_file):
|
|
| 35 |
print("💿 Установка библиотек, это займет какое-то время:\n")
|
| 36 |
|
| 37 |
install_lib = {
|
| 38 |
-
|
| 39 |
-
"aria2": "pip install aria2",
|
| 40 |
"localtunnel": "npm install -g localtunnel",
|
| 41 |
"insightface": "pip install insightface"
|
| 42 |
}
|
|
@@ -109,26 +109,12 @@ else:
|
|
| 109 |
os.environ["START_COLAB"] = str(start_colab)
|
| 110 |
|
| 111 |
# remove directory func
|
| 112 |
-
def _remove_dir(directory_path
|
| 113 |
-
if
|
| 114 |
-
raise ValueError("The directory path is empty")
|
| 115 |
-
|
| 116 |
-
try:
|
| 117 |
-
subprocess.run(['rm', '-rf', directory_path], check=True, capture_output=True)
|
| 118 |
-
if log:
|
| 119 |
-
print(f"Successfully executed: rm -rf {directory_path}")
|
| 120 |
-
except subprocess.CalledProcessError as e:
|
| 121 |
-
if log:
|
| 122 |
-
print(f"Failed to remove {directory_path} using rm -rf. Error: {e}")
|
| 123 |
-
|
| 124 |
-
if os.path.exists(directory_path):
|
| 125 |
try:
|
| 126 |
shutil.rmtree(directory_path)
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
except Exception as e:
|
| 130 |
-
if log:
|
| 131 |
-
print(f"Failed to remove {directory_path} using shutil. Error: {e}")
|
| 132 |
|
| 133 |
# Save files temporarily
|
| 134 |
temporarily_dir = f'{root_path}/temp_dir'
|
|
@@ -138,7 +124,8 @@ def copy_items_with_replace(src_base, dst_base):
|
|
| 138 |
'embeddings',
|
| 139 |
'models/Stable-diffusion',
|
| 140 |
'models/VAE',
|
| 141 |
-
'models/Lora'
|
|
|
|
| 142 |
]
|
| 143 |
|
| 144 |
print("Перемещение файлов...", end='')
|
|
@@ -154,19 +141,10 @@ def copy_items_with_replace(src_base, dst_base):
|
|
| 154 |
shutil.move(src, dst)
|
| 155 |
print("\r🔥 Файлы перемещены!" + " "*15)
|
| 156 |
|
| 157 |
-
def configure_environment():
|
| 158 |
-
os.chdir(root_path)
|
| 159 |
-
os.environ.update({
|
| 160 |
-
"SAFETENSORS_FAST_GPU": '1',
|
| 161 |
-
"CUDA_MODULE_LOADING": "LAZY",
|
| 162 |
-
"TF_CPP_MIN_LOG_LEVEL": "3",
|
| 163 |
-
"PYTHONWARNINGS": "ignore"
|
| 164 |
-
})
|
| 165 |
-
|
| 166 |
def download_and_unpack(url, dest_path):
|
| 167 |
-
aria2_args = "--
|
| 168 |
-
get_ipython().system(
|
| 169 |
-
get_ipython().system(
|
| 170 |
get_ipython().system('rm -rf repo.zip')
|
| 171 |
|
| 172 |
def handle_colab_timer(webui_path, timer_colab):
|
|
@@ -189,7 +167,6 @@ def unpack_webui():
|
|
| 189 |
download_url = "https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO_forge.zip"
|
| 190 |
|
| 191 |
download_and_unpack(download_url, webui_path)
|
| 192 |
-
configure_environment()
|
| 193 |
|
| 194 |
get_ipython().system(f'echo -n {start_colab} > {webui_path}/static/colabTimer.txt')
|
| 195 |
del cap
|
|
@@ -205,7 +182,7 @@ def unpack_webui():
|
|
| 205 |
# ================= MAIN CODE ==================
|
| 206 |
if os.path.exists(webui_path):
|
| 207 |
if UI != OLD_UI:
|
| 208 |
-
print(f'Переключение веб-интерфейса с \033[33m{OLD_UI}\033[0m на \033[33m{UI}\033[0m:\n'
|
| 209 |
copy_items_with_replace(webui_path, temporarily_dir)
|
| 210 |
_remove_dir(webui_path)
|
| 211 |
os.environ['SDW_OLD_UI'] = UI
|
|
@@ -248,10 +225,8 @@ anxety_repos = "https://huggingface.co/NagisaNao/fast_repo/resolve/main"
|
|
| 248 |
with capture.capture_output() as cap:
|
| 249 |
# --- Umi-Wildcard ---
|
| 250 |
get_ipython().system("sed -i '521s/open=\\(False\\|True\\)/open=False/' {webui_path}/extensions/Umi-AI-Wildcards/scripts/wildcard_recursive.py # Closed accordion by default")
|
| 251 |
-
|
| 252 |
# --- Encrypt-Image ---
|
| 253 |
get_ipython().system("sed -i '9,37d' {webui_path}/extensions/Encrypt-Image/javascript/encrypt_images_info.js # Removes the weird text in webui")
|
| 254 |
-
|
| 255 |
# --- Additional-Networks ---
|
| 256 |
get_ipython().system('wget -O {webui_path}/extensions/additional-networks/scripts/metadata_editor.py {anxety_repos}/extensions/Additional-Networks/fix/metadata_editor.py # Fixing an error due to old style')
|
| 257 |
del cap
|
|
@@ -453,7 +428,7 @@ def manual_download(url, dst_dir, file_name):
|
|
| 453 |
""" Formatted info output """
|
| 454 |
model_name_or_basename = file_name if file_name else basename
|
| 455 |
try:
|
| 456 |
-
format_output(clean_url or url, dst_dir, model_name_or_basename,
|
| 457 |
except UnboundLocalError:
|
| 458 |
format_output(clean_url or url, dst_dir, model_name_or_basename, None, None)
|
| 459 |
|
|
|
|
| 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 |
# ================ LIBRARIES V2 ================
|
|
|
|
| 35 |
print("💿 Установка библиотек, это займет какое-то время:\n")
|
| 36 |
|
| 37 |
install_lib = {
|
| 38 |
+
"aria2": "apt -y install aria2",
|
| 39 |
+
# "aria2": "pip install aria2",
|
| 40 |
"localtunnel": "npm install -g localtunnel",
|
| 41 |
"insightface": "pip install insightface"
|
| 42 |
}
|
|
|
|
| 109 |
os.environ["START_COLAB"] = str(start_colab)
|
| 110 |
|
| 111 |
# remove directory func
|
| 112 |
+
def _remove_dir(directory_path):
|
| 113 |
+
if directory_path and os.path.exists(directory_path):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
try:
|
| 115 |
shutil.rmtree(directory_path)
|
| 116 |
+
except Exception:
|
| 117 |
+
get_ipython().system('rm -rf {directory_path}')
|
|
|
|
|
|
|
|
|
|
| 118 |
|
| 119 |
# Save files temporarily
|
| 120 |
temporarily_dir = f'{root_path}/temp_dir'
|
|
|
|
| 124 |
'embeddings',
|
| 125 |
'models/Stable-diffusion',
|
| 126 |
'models/VAE',
|
| 127 |
+
'models/Lora',
|
| 128 |
+
'models/ControlNet'
|
| 129 |
]
|
| 130 |
|
| 131 |
print("Перемещение файлов...", end='')
|
|
|
|
| 141 |
shutil.move(src, dst)
|
| 142 |
print("\r🔥 Файлы перемещены!" + " "*15)
|
| 143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
def download_and_unpack(url, dest_path):
|
| 145 |
+
aria2_args = "--console-log-level=error -c -x 16 -s 16 -k 1M"
|
| 146 |
+
get_ipython().system("aria2c {aria2_args} '{url}' -o repo.zip")
|
| 147 |
+
get_ipython().system('unzip -q -o repo.zip -d {dest_path}')
|
| 148 |
get_ipython().system('rm -rf repo.zip')
|
| 149 |
|
| 150 |
def handle_colab_timer(webui_path, timer_colab):
|
|
|
|
| 167 |
download_url = "https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO_forge.zip"
|
| 168 |
|
| 169 |
download_and_unpack(download_url, webui_path)
|
|
|
|
| 170 |
|
| 171 |
get_ipython().system(f'echo -n {start_colab} > {webui_path}/static/colabTimer.txt')
|
| 172 |
del cap
|
|
|
|
| 182 |
# ================= MAIN CODE ==================
|
| 183 |
if os.path.exists(webui_path):
|
| 184 |
if UI != OLD_UI:
|
| 185 |
+
print(f'Переключение веб-интерфейса с \033[33m{OLD_UI}\033[0m на \033[33m{UI}\033[0m:\n')
|
| 186 |
copy_items_with_replace(webui_path, temporarily_dir)
|
| 187 |
_remove_dir(webui_path)
|
| 188 |
os.environ['SDW_OLD_UI'] = UI
|
|
|
|
| 225 |
with capture.capture_output() as cap:
|
| 226 |
# --- Umi-Wildcard ---
|
| 227 |
get_ipython().system("sed -i '521s/open=\\(False\\|True\\)/open=False/' {webui_path}/extensions/Umi-AI-Wildcards/scripts/wildcard_recursive.py # Closed accordion by default")
|
|
|
|
| 228 |
# --- Encrypt-Image ---
|
| 229 |
get_ipython().system("sed -i '9,37d' {webui_path}/extensions/Encrypt-Image/javascript/encrypt_images_info.js # Removes the weird text in webui")
|
|
|
|
| 230 |
# --- Additional-Networks ---
|
| 231 |
get_ipython().system('wget -O {webui_path}/extensions/additional-networks/scripts/metadata_editor.py {anxety_repos}/extensions/Additional-Networks/fix/metadata_editor.py # Fixing an error due to old style')
|
| 232 |
del cap
|
|
|
|
| 428 |
""" Formatted info output """
|
| 429 |
model_name_or_basename = file_name if file_name else basename
|
| 430 |
try:
|
| 431 |
+
format_output(clean_url or url, dst_dir, model_name_or_basename, image_name, image_url)
|
| 432 |
except UnboundLocalError:
|
| 433 |
format_output(clean_url or url, dst_dir, model_name_or_basename, None, None)
|
| 434 |
|
files_cells/python/ru/widgets_ru.py
CHANGED
|
@@ -281,13 +281,10 @@ def setup_webui(change_webui_widget):
|
|
| 281 |
os.environ['SDW_OLD_UI'] = change_webui_widget
|
| 282 |
|
| 283 |
UI = os.getenv('SDW_UI')
|
| 284 |
-
OLD_UI = os.getenv('SDW_OLD_UI')
|
| 285 |
|
| 286 |
if UI != change_webui_widget:
|
| 287 |
os.environ['SDW_UI'] = change_webui_widget
|
| 288 |
|
| 289 |
-
# print(f'Current UI: {os.getenv("SDW_UI")}, Old UI: {os.getenv("SDW_OLD_UI")}')
|
| 290 |
-
|
| 291 |
|
| 292 |
# ============ Load / Save - Settings V2 ============
|
| 293 |
SETTINGS_FILE = f'{root_path}/settings.json'
|
|
@@ -322,8 +319,8 @@ def hide_widgets():
|
|
| 322 |
widgets.Widget.close_all()
|
| 323 |
|
| 324 |
def save_data(button):
|
| 325 |
-
setup_webui(change_webui_widget.value)
|
| 326 |
save_settings()
|
|
|
|
| 327 |
hide_widgets()
|
| 328 |
|
| 329 |
load_settings()
|
|
|
|
| 281 |
os.environ['SDW_OLD_UI'] = change_webui_widget
|
| 282 |
|
| 283 |
UI = os.getenv('SDW_UI')
|
|
|
|
| 284 |
|
| 285 |
if UI != change_webui_widget:
|
| 286 |
os.environ['SDW_UI'] = change_webui_widget
|
| 287 |
|
|
|
|
|
|
|
| 288 |
|
| 289 |
# ============ Load / Save - Settings V2 ============
|
| 290 |
SETTINGS_FILE = f'{root_path}/settings.json'
|
|
|
|
| 319 |
widgets.Widget.close_all()
|
| 320 |
|
| 321 |
def save_data(button):
|
|
|
|
| 322 |
save_settings()
|
| 323 |
+
setup_webui(change_webui_widget.value)
|
| 324 |
hide_widgets()
|
| 325 |
|
| 326 |
load_settings()
|