NagisaNao commited on
Commit
fd40be2
·
verified ·
1 Parent(s): 1d72411

🚧 Saving files when switching WebUIs

Browse files
files_cells/notebooks/en/downloading_en.ipynb CHANGED
@@ -111,18 +111,47 @@
111
  "\n",
112
  "\n",
113
  "# ================= OTHER =================\n",
 
114
  "try:\n",
115
  " start_colab\n",
116
  "except:\n",
117
  " start_colab = int(time.time())-5\n",
118
  "\n",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  "\n",
120
  "# ================= MAIN CODE =================\n",
121
  "# WebUI switch\n",
122
  "if os.path.exists(webui_path):\n",
123
  " if UI != OLD_UI:\n",
124
  " print(f'Switching the WebUI from \\033[33m{OLD_UI}\\033[0m to \\033[33m{UI}\\033[0m...', end='')\n",
 
125
  " shutil.rmtree(webui_path)\n",
 
126
  " # Updating the environment variable after a change\n",
127
  " os.environ['SDW_OLD_UI'] = UI\n",
128
  " print('\\rDone!')\n",
@@ -132,15 +161,16 @@
132
  "# Unpacking the WebUI\n",
133
  "if not os.path.exists(webui_path):\n",
134
  " start_install = int(time.time())\n",
135
- " print(\"⌚ Unpacking Stable Diffusion...\" if UI != 'Forge' else \"⌚ Unpacking Stable Diffusion (Forge)...\", end='')\n",
136
  " with capture.capture_output() as cap:\n",
137
  " aria2_command = \"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M\"\n",
138
- " url = \"https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO.zip\" if UI != 'Forge' else \"https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO_forge.zip\"\n",
139
  " !{aria2_command} {url} -o repo.zip\n",
140
  "\n",
141
  " !unzip -q -o repo.zip -d {webui_path}\n",
142
  " !rm -rf repo.zip\n",
143
  "\n",
 
144
  " %cd {root_path}\n",
145
  " os.environ[\"SAFETENSORS_FAST_GPU\"]='1'\n",
146
  " os.environ[\"CUDA_MODULE_LOADING\"]=\"LAZY\"\n",
@@ -151,6 +181,11 @@
151
  " del cap\n",
152
  " install_time = timedelta(seconds=time.time()-start_install)\n",
153
  " print(\"\\r🚀 Unpacking is complete! For\",\"%02d:%02d:%02d ⚡\\n\" % (install_time.seconds / 3600, (install_time.seconds / 60) % 60, install_time.seconds % 60), end='', flush=True)\n",
 
 
 
 
 
154
  "else:\n",
155
  " print(\"🚀 All unpacked... Skip. ⚡\")\n",
156
  " start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())\n",
 
111
  "\n",
112
  "\n",
113
  "# ================= OTHER =================\n",
114
+ "# Setup Timer\n",
115
  "try:\n",
116
  " start_colab\n",
117
  "except:\n",
118
  " start_colab = int(time.time())-5\n",
119
  "\n",
120
+ "# Save files temporarily\n",
121
+ "temporarily_dir = f'{root_path}/temp_dir'\n",
122
+ "\n",
123
+ "def copy_items_with_replace(src_base, dst_base):\n",
124
+ " items_to_copy = [\n",
125
+ " 'embeddings',\n",
126
+ " 'models/Stable-diffusion',\n",
127
+ " 'models/VAE',\n",
128
+ " 'models/Lora'\n",
129
+ " ]\n",
130
+ "\n",
131
+ " print(\"- There's a file move in progress... (This can take a minute or more)\", end='')\n",
132
+ " for item in items_to_copy:\n",
133
+ " src = os.path.join(src_base, item)\n",
134
+ " dst = os.path.join(dst_base, item)\n",
135
+ "\n",
136
+ " if os.path.isdir(src):\n",
137
+ " if os.path.exists(dst):\n",
138
+ " shutil.rmtree(dst)\n",
139
+ " shutil.move(src, dst)\n",
140
+ " elif os.path.isfile(src):\n",
141
+ " dst_dir = os.path.dirname(dst)\n",
142
+ " os.makedirs(dst_dir, exist_ok=True)\n",
143
+ " shutil.move(src, dst)\n",
144
+ " print(\"\\r🔥 The files have been moved!\")\n",
145
+ "\n",
146
  "\n",
147
  "# ================= MAIN CODE =================\n",
148
  "# WebUI switch\n",
149
  "if os.path.exists(webui_path):\n",
150
  " if UI != OLD_UI:\n",
151
  " print(f'Switching the WebUI from \\033[33m{OLD_UI}\\033[0m to \\033[33m{UI}\\033[0m...', end='')\n",
152
+ " copy_items_with_replace(webui_path, temporarily_dir)\n",
153
  " shutil.rmtree(webui_path)\n",
154
+ "\n",
155
  " # Updating the environment variable after a change\n",
156
  " os.environ['SDW_OLD_UI'] = UI\n",
157
  " print('\\rDone!')\n",
 
161
  "# Unpacking the WebUI\n",
162
  "if not os.path.exists(webui_path):\n",
163
  " start_install = int(time.time())\n",
164
+ " print(\"⌚ Unpacking Stable Diffusion...\" if change_webui != 'Forge' else \"⌚ Unpacking Stable Diffusion (Forge)...\", end='')\n",
165
  " with capture.capture_output() as cap:\n",
166
  " aria2_command = \"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M\"\n",
167
+ " url = \"https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO.zip\" if change_webui != 'Forge' else \"https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO_forge.zip\"\n",
168
  " !{aria2_command} {url} -o repo.zip\n",
169
  "\n",
170
  " !unzip -q -o repo.zip -d {webui_path}\n",
171
  " !rm -rf repo.zip\n",
172
  "\n",
173
+ " # other\n",
174
  " %cd {root_path}\n",
175
  " os.environ[\"SAFETENSORS_FAST_GPU\"]='1'\n",
176
  " os.environ[\"CUDA_MODULE_LOADING\"]=\"LAZY\"\n",
 
181
  " del cap\n",
182
  " install_time = timedelta(seconds=time.time()-start_install)\n",
183
  " print(\"\\r🚀 Unpacking is complete! For\",\"%02d:%02d:%02d ⚡\\n\" % (install_time.seconds / 3600, (install_time.seconds / 60) % 60, install_time.seconds % 60), end='', flush=True)\n",
184
+ "\n",
185
+ " # Move temporary files\n",
186
+ " if os.path.exists(temporarily_dir):\n",
187
+ " copy_items_with_replace(temporarily_dir, webui_path)\n",
188
+ " shutil.rmtree(temporarily_dir)\n",
189
  "else:\n",
190
  " print(\"🚀 All unpacked... Skip. ⚡\")\n",
191
  " start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())\n",
files_cells/notebooks/ru/downloading_ru.ipynb CHANGED
@@ -110,19 +110,48 @@
110
  "locals().update({key: settings.get(key) for key in VARIABLES})\n",
111
  "\n",
112
  "\n",
113
- "# ================= OTHER =================\n",
 
114
  "try:\n",
115
  " start_colab\n",
116
  "except:\n",
117
  " start_colab = int(time.time())-5\n",
118
  "\n",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  "\n",
120
  "# ================= MAIN CODE =================\n",
121
  "# WebUI switch\n",
122
  "if os.path.exists(webui_path):\n",
123
  " if UI != OLD_UI:\n",
124
  " print(f'Переключение веб-интерфейса с \\033[33m{OLD_UI}\\033[0m на \\033[33m{UI}\\033[0m...', end='')\n",
 
125
  " shutil.rmtree(webui_path)\n",
 
126
  " # Updating the environment variable after a change\n",
127
  " os.environ['SDW_OLD_UI'] = UI\n",
128
  " print('\\rГотово!')\n",
@@ -132,16 +161,17 @@
132
  "# Unpacking the WebUI\n",
133
  "if not os.path.exists(webui_path):\n",
134
  " start_install = int(time.time())\n",
135
- " print(\"⌚ Распаковка Stable Diffusion...\" if UI != 'Forge' else \"⌚ Распаковка Stable Diffusion (Forge)...\", end='')\n",
136
  " with capture.capture_output() as cap:\n",
137
  " aria2_command = \"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M\"\n",
138
- " url = \"https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO.zip\" if UI != 'Forge' else \"https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO_forge.zip\"\n",
139
  " !{aria2_command} {url} -o repo.zip\n",
140
  "\n",
141
  " !unzip -q -o repo.zip -d {webui_path}\n",
142
  " !rm -rf repo.zip\n",
143
  "\n",
144
- " %cd {root_path}\n",
 
145
  " os.environ[\"SAFETENSORS_FAST_GPU\"]='1'\n",
146
  " os.environ[\"CUDA_MODULE_LOADING\"]=\"LAZY\"\n",
147
  " os.environ[\"TF_CPP_MIN_LOG_LEVEL\"] = \"3\"\n",
@@ -151,6 +181,11 @@
151
  " del cap\n",
152
  " install_time = timedelta(seconds=time.time()-start_install)\n",
153
  " print(\"\\r🚀 Распаковка Завершена! За\",\"%02d:%02d:%02d ⚡\\n\" % (install_time.seconds / 3600, (install_time.seconds / 60) % 60, install_time.seconds % 60), end='', flush=True)\n",
 
 
 
 
 
154
  "else:\n",
155
  " print(\"🚀 Все распакованно... Пропуск. ⚡\")\n",
156
  " start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())\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
  "try:\n",
116
  " start_colab\n",
117
  "except:\n",
118
  " start_colab = int(time.time())-5\n",
119
  "\n",
120
+ "# Save files temporarily\n",
121
+ "temporarily_dir = f'{root_path}/temp_dir'\n",
122
+ "\n",
123
+ "def copy_items_with_replace(src_base, dst_base):\n",
124
+ " items_to_copy = [\n",
125
+ " 'embeddings',\n",
126
+ " 'models/Stable-diffusion',\n",
127
+ " 'models/VAE',\n",
128
+ " 'models/Lora'\n",
129
+ " ]\n",
130
+ "\n",
131
+ " print(\"- Идет перемещение файлов... (Это может занять минуту или больше)\", end='')\n",
132
+ " for item in items_to_copy:\n",
133
+ " src = os.path.join(src_base, item)\n",
134
+ " dst = os.path.join(dst_base, item)\n",
135
+ "\n",
136
+ " if os.path.isdir(src):\n",
137
+ " if os.path.exists(dst):\n",
138
+ " shutil.rmtree(dst)\n",
139
+ " shutil.move(src, dst)\n",
140
+ " elif os.path.isfile(src):\n",
141
+ " dst_dir = os.path.dirname(dst)\n",
142
+ " os.makedirs(dst_dir, exist_ok=True)\n",
143
+ " shutil.move(src, dst)\n",
144
+ " print(\"\\r🔥 Файлы были перемещены!\")\n",
145
+ "\n",
146
  "\n",
147
  "# ================= MAIN CODE =================\n",
148
  "# WebUI switch\n",
149
  "if os.path.exists(webui_path):\n",
150
  " if UI != OLD_UI:\n",
151
  " print(f'Переключение веб-интерфейса с \\033[33m{OLD_UI}\\033[0m на \\033[33m{UI}\\033[0m...', end='')\n",
152
+ " copy_items_with_replace(webui_path, temporarily_dir)\n",
153
  " shutil.rmtree(webui_path)\n",
154
+ "\n",
155
  " # Updating the environment variable after a change\n",
156
  " os.environ['SDW_OLD_UI'] = UI\n",
157
  " print('\\rГотово!')\n",
 
161
  "# Unpacking the WebUI\n",
162
  "if not os.path.exists(webui_path):\n",
163
  " start_install = int(time.time())\n",
164
+ " print(\"⌚ Распаковка Stable Diffusion...\" if change_webui != 'Forge' else \"⌚ Распаковка Stable Diffusion (Forge)...\", end='')\n",
165
  " with capture.capture_output() as cap:\n",
166
  " aria2_command = \"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M\"\n",
167
+ " url = \"https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO.zip\" if change_webui != 'Forge' else \"https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO_forge.zip\"\n",
168
  " !{aria2_command} {url} -o repo.zip\n",
169
  "\n",
170
  " !unzip -q -o repo.zip -d {webui_path}\n",
171
  " !rm -rf repo.zip\n",
172
  "\n",
173
+ " # other\n",
174
+ " get_ipython().run_line_magic('cd', '{root_path}')\n",
175
  " os.environ[\"SAFETENSORS_FAST_GPU\"]='1'\n",
176
  " os.environ[\"CUDA_MODULE_LOADING\"]=\"LAZY\"\n",
177
  " os.environ[\"TF_CPP_MIN_LOG_LEVEL\"] = \"3\"\n",
 
181
  " del cap\n",
182
  " install_time = timedelta(seconds=time.time()-start_install)\n",
183
  " print(\"\\r🚀 Распаковка Завершена! За\",\"%02d:%02d:%02d ⚡\\n\" % (install_time.seconds / 3600, (install_time.seconds / 60) % 60, install_time.seconds % 60), end='', flush=True)\n",
184
+ "\n",
185
+ " # Move temporary files\n",
186
+ " if os.path.exists(temporarily_dir):\n",
187
+ " copy_items_with_replace(temporarily_dir, webui_path)\n",
188
+ " shutil.rmtree(temporarily_dir)\n",
189
  "else:\n",
190
  " print(\"🚀 Все распакованно... Пропуск. ⚡\")\n",
191
  " start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())\n",
files_cells/python/en/downloading_en.py CHANGED
@@ -101,18 +101,47 @@ locals().update({key: settings.get(key) for key in VARIABLES})
101
 
102
 
103
  # ================= OTHER =================
 
104
  try:
105
  start_colab
106
  except:
107
  start_colab = int(time.time())-5
108
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
 
110
  # ================= MAIN CODE =================
111
  # WebUI switch
112
  if os.path.exists(webui_path):
113
  if UI != OLD_UI:
114
  print(f'Switching the WebUI from \033[33m{OLD_UI}\033[0m to \033[33m{UI}\033[0m...', end='')
 
115
  shutil.rmtree(webui_path)
 
116
  # Updating the environment variable after a change
117
  os.environ['SDW_OLD_UI'] = UI
118
  print('\rDone!')
@@ -122,15 +151,16 @@ if os.path.exists(webui_path):
122
  # Unpacking the WebUI
123
  if not os.path.exists(webui_path):
124
  start_install = int(time.time())
125
- print("⌚ Unpacking Stable Diffusion..." if UI != 'Forge' else "⌚ Unpacking Stable Diffusion (Forge)...", end='')
126
  with capture.capture_output() as cap:
127
  aria2_command = "aria2c --console-log-level=error -c -x 16 -s 16 -k 1M"
128
- url = "https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO.zip" if UI != 'Forge' else "https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO_forge.zip"
129
  get_ipython().system('{aria2_command} {url} -o repo.zip')
130
 
131
  get_ipython().system('unzip -q -o repo.zip -d {webui_path}')
132
  get_ipython().system('rm -rf repo.zip')
133
 
 
134
  get_ipython().run_line_magic('cd', '{root_path}')
135
  os.environ["SAFETENSORS_FAST_GPU"]='1'
136
  os.environ["CUDA_MODULE_LOADING"]="LAZY"
@@ -141,6 +171,11 @@ if not os.path.exists(webui_path):
141
  del cap
142
  install_time = timedelta(seconds=time.time()-start_install)
143
  print("\r🚀 Unpacking is complete! For","%02d:%02d:%02d ⚡\n" % (install_time.seconds / 3600, (install_time.seconds / 60) % 60, install_time.seconds % 60), end='', flush=True)
 
 
 
 
 
144
  else:
145
  print("🚀 All unpacked... Skip. ⚡")
146
  start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())
 
101
 
102
 
103
  # ================= OTHER =================
104
+ # Setup Timer
105
  try:
106
  start_colab
107
  except:
108
  start_colab = int(time.time())-5
109
 
110
+ # Save files temporarily
111
+ temporarily_dir = f'{root_path}/temp_dir'
112
+
113
+ def copy_items_with_replace(src_base, dst_base):
114
+ items_to_copy = [
115
+ 'embeddings',
116
+ 'models/Stable-diffusion',
117
+ 'models/VAE',
118
+ 'models/Lora'
119
+ ]
120
+
121
+ print("- There's a file move in progress... (This can take a minute or more)", end='')
122
+ for item in items_to_copy:
123
+ src = os.path.join(src_base, item)
124
+ dst = os.path.join(dst_base, item)
125
+
126
+ if os.path.isdir(src):
127
+ if os.path.exists(dst):
128
+ shutil.rmtree(dst)
129
+ shutil.move(src, dst)
130
+ elif os.path.isfile(src):
131
+ dst_dir = os.path.dirname(dst)
132
+ os.makedirs(dst_dir, exist_ok=True)
133
+ shutil.move(src, dst)
134
+ print("\r🔥 The files have been moved!")
135
+
136
 
137
  # ================= MAIN CODE =================
138
  # WebUI switch
139
  if os.path.exists(webui_path):
140
  if UI != OLD_UI:
141
  print(f'Switching the WebUI from \033[33m{OLD_UI}\033[0m to \033[33m{UI}\033[0m...', end='')
142
+ copy_items_with_replace(webui_path, temporarily_dir)
143
  shutil.rmtree(webui_path)
144
+
145
  # Updating the environment variable after a change
146
  os.environ['SDW_OLD_UI'] = UI
147
  print('\rDone!')
 
151
  # Unpacking the WebUI
152
  if not os.path.exists(webui_path):
153
  start_install = int(time.time())
154
+ print("⌚ Unpacking Stable Diffusion..." if change_webui != 'Forge' else "⌚ Unpacking Stable Diffusion (Forge)...", end='')
155
  with capture.capture_output() as cap:
156
  aria2_command = "aria2c --console-log-level=error -c -x 16 -s 16 -k 1M"
157
+ url = "https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO.zip" if change_webui != 'Forge' else "https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO_forge.zip"
158
  get_ipython().system('{aria2_command} {url} -o repo.zip')
159
 
160
  get_ipython().system('unzip -q -o repo.zip -d {webui_path}')
161
  get_ipython().system('rm -rf repo.zip')
162
 
163
+ # other
164
  get_ipython().run_line_magic('cd', '{root_path}')
165
  os.environ["SAFETENSORS_FAST_GPU"]='1'
166
  os.environ["CUDA_MODULE_LOADING"]="LAZY"
 
171
  del cap
172
  install_time = timedelta(seconds=time.time()-start_install)
173
  print("\r🚀 Unpacking is complete! For","%02d:%02d:%02d ⚡\n" % (install_time.seconds / 3600, (install_time.seconds / 60) % 60, install_time.seconds % 60), end='', flush=True)
174
+
175
+ # Move temporary files
176
+ if os.path.exists(temporarily_dir):
177
+ copy_items_with_replace(temporarily_dir, webui_path)
178
+ shutil.rmtree(temporarily_dir)
179
  else:
180
  print("🚀 All unpacked... Skip. ⚡")
181
  start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())
files_cells/python/ru/downloading_ru.py CHANGED
@@ -100,19 +100,48 @@ VARIABLES = [
100
  locals().update({key: settings.get(key) for key in VARIABLES})
101
 
102
 
103
- # ================= OTHER =================
 
104
  try:
105
  start_colab
106
  except:
107
  start_colab = int(time.time())-5
108
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
 
110
  # ================= MAIN CODE =================
111
  # WebUI switch
112
  if os.path.exists(webui_path):
113
  if UI != OLD_UI:
114
  print(f'Переключение веб-интерфейса с \033[33m{OLD_UI}\033[0m на \033[33m{UI}\033[0m...', end='')
 
115
  shutil.rmtree(webui_path)
 
116
  # Updating the environment variable after a change
117
  os.environ['SDW_OLD_UI'] = UI
118
  print('\rГотово!')
@@ -122,15 +151,16 @@ if os.path.exists(webui_path):
122
  # Unpacking the WebUI
123
  if not os.path.exists(webui_path):
124
  start_install = int(time.time())
125
- print("⌚ Распаковка Stable Diffusion..." if UI != 'Forge' else "⌚ Распаковка Stable Diffusion (Forge)...", end='')
126
  with capture.capture_output() as cap:
127
  aria2_command = "aria2c --console-log-level=error -c -x 16 -s 16 -k 1M"
128
- url = "https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO.zip" if UI != 'Forge' else "https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO_forge.zip"
129
  get_ipython().system('{aria2_command} {url} -o repo.zip')
130
 
131
  get_ipython().system('unzip -q -o repo.zip -d {webui_path}')
132
  get_ipython().system('rm -rf repo.zip')
133
 
 
134
  get_ipython().run_line_magic('cd', '{root_path}')
135
  os.environ["SAFETENSORS_FAST_GPU"]='1'
136
  os.environ["CUDA_MODULE_LOADING"]="LAZY"
@@ -141,6 +171,11 @@ if not os.path.exists(webui_path):
141
  del cap
142
  install_time = timedelta(seconds=time.time()-start_install)
143
  print("\r🚀 Распаковка Завершена! За","%02d:%02d:%02d ⚡\n" % (install_time.seconds / 3600, (install_time.seconds / 60) % 60, install_time.seconds % 60), end='', flush=True)
 
 
 
 
 
144
  else:
145
  print("🚀 Все распакованно... Пропуск. ⚡")
146
  start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())
 
100
  locals().update({key: settings.get(key) for key in VARIABLES})
101
 
102
 
103
+ # =================== OTHER ===================
104
+ # Setup Timer
105
  try:
106
  start_colab
107
  except:
108
  start_colab = int(time.time())-5
109
 
110
+ # Save files temporarily
111
+ temporarily_dir = f'{root_path}/temp_dir'
112
+
113
+ def copy_items_with_replace(src_base, dst_base):
114
+ items_to_copy = [
115
+ 'embeddings',
116
+ 'models/Stable-diffusion',
117
+ 'models/VAE',
118
+ 'models/Lora'
119
+ ]
120
+
121
+ print("- Идет перемещение файлов... (Это может занять минуту или больше)", end='')
122
+ for item in items_to_copy:
123
+ src = os.path.join(src_base, item)
124
+ dst = os.path.join(dst_base, item)
125
+
126
+ if os.path.isdir(src):
127
+ if os.path.exists(dst):
128
+ shutil.rmtree(dst)
129
+ shutil.move(src, dst)
130
+ elif os.path.isfile(src):
131
+ dst_dir = os.path.dirname(dst)
132
+ os.makedirs(dst_dir, exist_ok=True)
133
+ shutil.move(src, dst)
134
+ print("\r🔥 Файлы были перемещены!")
135
+
136
 
137
  # ================= MAIN CODE =================
138
  # WebUI switch
139
  if os.path.exists(webui_path):
140
  if UI != OLD_UI:
141
  print(f'Переключение веб-интерфейса с \033[33m{OLD_UI}\033[0m на \033[33m{UI}\033[0m...', end='')
142
+ copy_items_with_replace(webui_path, temporarily_dir)
143
  shutil.rmtree(webui_path)
144
+
145
  # Updating the environment variable after a change
146
  os.environ['SDW_OLD_UI'] = UI
147
  print('\rГотово!')
 
151
  # Unpacking the WebUI
152
  if not os.path.exists(webui_path):
153
  start_install = int(time.time())
154
+ print("⌚ Распаковка Stable Diffusion..." if change_webui != 'Forge' else "⌚ Распаковка Stable Diffusion (Forge)...", end='')
155
  with capture.capture_output() as cap:
156
  aria2_command = "aria2c --console-log-level=error -c -x 16 -s 16 -k 1M"
157
+ url = "https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO.zip" if change_webui != 'Forge' else "https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO_forge.zip"
158
  get_ipython().system('{aria2_command} {url} -o repo.zip')
159
 
160
  get_ipython().system('unzip -q -o repo.zip -d {webui_path}')
161
  get_ipython().system('rm -rf repo.zip')
162
 
163
+ # other
164
  get_ipython().run_line_magic('cd', '{root_path}')
165
  os.environ["SAFETENSORS_FAST_GPU"]='1'
166
  os.environ["CUDA_MODULE_LOADING"]="LAZY"
 
171
  del cap
172
  install_time = timedelta(seconds=time.time()-start_install)
173
  print("\r🚀 Распаковка Завершена! За","%02d:%02d:%02d ⚡\n" % (install_time.seconds / 3600, (install_time.seconds / 60) % 60, install_time.seconds % 60), end='', flush=True)
174
+
175
+ # Move temporary files
176
+ if os.path.exists(temporarily_dir):
177
+ copy_items_with_replace(temporarily_dir, webui_path)
178
+ shutil.rmtree(temporarily_dir)
179
  else:
180
  print("🚀 Все распакованно... Пропуск. ⚡")
181
  start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())