ACCA225 commited on
Commit
6bf60b0
1 Parent(s): 0215963

Update app3.py

Browse files
Files changed (1) hide show
  1. app3.py +19 -28
app3.py CHANGED
@@ -30,9 +30,9 @@ import os
30
 
31
  def remove_restart():
32
  os.chdir("/home/xlab-app-center/stable-diffusion-webui/html")
33
- os.system("rm ./footer.html && wget -O footer.html https://hf-mirror.com/datasets/ACCA225/openxlab/resolve/main/footer.html")
34
  os.chdir("/home/xlab-app-center/stable-diffusion-webui/modules")
35
- os.system("rm ./ui_settings.py && wget -O ui_settings.py https://hf-mirror.com/datasets/ACCA225/openxlab/resolve/main/ui_settings.py ")
36
  remove_restart()
37
  def create_directory(directory_path):
38
  if not os.path.exists(directory_path):
@@ -49,13 +49,13 @@ configs_directory = os.path.join(base_directory, 'configs')
49
  create_directory(configs_directory)
50
 
51
  # 下载配置文件
52
- #download_file('https://hf-mirror.com/datasets/ACCA225/openxlab/resolve/main/config-pub.json', os.path.join(configs_directory, 'config.json'))
53
- #download_file('https://hf-mirror.com/datasets/ACCA225/openxlab/resolve/main/ui-config-pri2.json', os.path.join(configs_directory, 'ui-config-pri.json'))
54
- #download_file('https://hf-mirror.com/datasets/ACCA225/openxlab/resolve/main/ui-config-pub.json', os.path.join(configs_directory, 'ui-config.json'))
55
  # 下载配置文件
56
- download_file('https://hf-mirror.com/datasets/ACCA225/openxlab/resolve/main/config-pub.json', os.path.join(base_directory, 'config.json'))
57
- download_file('https://hf-mirror.com/datasets/ACCA225/openxlab/resolve/main/ui-config-pri2.json', os.path.join(base_directory, 'ui-config-pri.json'))
58
- download_file('https://hf-mirror.com/datasets/ACCA225/openxlab/resolve/main/ui-config-pub.json', os.path.join(base_directory, 'ui-config.json'))
59
 
60
  os.chdir(f"/home/xlab-app-center/stable-diffusion-webui/extensions")
61
  os.system(f"rm -rf ./batchlinks-webui")
@@ -103,8 +103,8 @@ def sdmodel():
103
  def download_with_aria2(urls):
104
  # 使用循环遍历所有的下载链接
105
  for url in urls:
106
- # 将huggingface.co替换为hf-mirror.com
107
- url = url.replace('huggingface.co', 'hf-mirror.com')
108
  file_name = url.split('/')[-1].split('?')[0]
109
  # 构建aria2c命令
110
  command = f'aria2c -x 16 -s 16 -c -k 1M -o "{file_name}" "{url}" -d /home/xlab-app-center/stable-diffusion-webui/models/Stable-diffusion'
@@ -172,27 +172,18 @@ for plugin in plugins:
172
  os.system(f"git clone {plugin}")
173
  os.makedirs('/home/xlab-app-center/stable-diffusion-webui/models/adetailer', exist_ok=True)
174
  os.chdir(f"/home/xlab-app-center/stable-diffusion-webui/models/adetailer")
175
- os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mirror.com/Bingsu/adetailer/resolve/main/hand_yolov8s.pt -d /home/xlab-app-center/stable-diffusion-webui/models/adetailer -o hand_yolov8s.pt")
176
- os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mirror.com/Bingsu/adetailer/resolve/main/hand_yolov8n.pt -d /home/xlab-app-center/stable-diffusion-webui/models/adetailer -o hand_yolov8n.pt")
177
- os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mirror.com/datasets/ACCC1380/private-model/resolve/main/kaggle/input/museum/131-half.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Stable-diffusion -o [萌二次元]131-half.safetensors")
178
  os.system(f"rm /home/xlab-app-center/stable-diffusion-webui/models/Stable-diffusion/*porn*.safetensors")
179
- os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mirror.com/datasets/ACCC1380/private-model/resolve/main/ba.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Lora -o ba.safetensors")
180
- os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mirror.com/datasets/ACCC1380/private-model/resolve/main/racaco2.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Lora -o racaco2.safetensors")
181
- os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mirror.com/coinz/Add-detail/resolve/main/add_detail.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Lora -o add_detail.safetensors")
182
- os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mirror.com/datasets/VASVASVAS/vae/resolve/main/pastel-waifu-diffusion.vae.pt -d /home/xlab-app-center/stable-diffusion-webui/models/VAE -o pastel-waifu-diffusion.vae.pt")
183
  # os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://download.openxlab.org.cn/models/camenduru/sdxl-refiner-1.0/weight//sd_xl_refiner_1.0.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Stable-diffusion -o sd_xl_refiner_1.0.safetensors")
184
  # os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://download.openxlab.org.cn/models/camenduru/cyber-realistic/weight//cyberrealistic_v32.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Stable-diffusion -o cyberrealistic_v32.safetensors")
185
  os.chdir(f"/home/xlab-app-center/stable-diffusion-webui")
186
  print('webui launching...')
187
- package_envs = [
188
- {"env": "STABLE_DIFFUSION_REPO", "url": os.environ.get('STABLE_DIFFUSION_REPO', "https://gitcode.net/overbill1683/stablediffusion")},
189
- {"env": "STABLE_DIFFUSION_XL_REPO", "url": os.environ.get('STABLE_DIFFUSION_XL_REPO', "https://gitcode.net/overbill1683/generative-models")},
190
- {"env": "K_DIFFUSION_REPO", "url": os.environ.get('K_DIFFUSION_REPO', "https://gitcode.net/overbill1683/k-diffusion")},
191
- {"env": "CODEFORMER_REPO", "url": os.environ.get('CODEFORMER_REPO', "https://gitcode.net/overbill1683/CodeFormer")},
192
- {"env": "BLIP_REPO", "url": os.environ.get('BLIP_REPO', "https://gitcode.net/overbill1683/BLIP")},
193
- ]
194
- os.environ["PIP_INDEX_URL"] = "https://mirrors.aliyun.com/pypi/simple/"
195
- for i in package_envs:
196
  os.environ[i["env"]] = i["url"]
197
 
198
  import os
@@ -247,7 +238,7 @@ def monitor_gpu():
247
  time.sleep(60)
248
  def zrok():
249
 
250
- #os.system("wget https://hf-mirror.com/datasets/ACCA225/frp-1/resolve/main/frpc")
251
  #os.system("chmod +x ./frpc")
252
  #os.system("./frpc -f bsnehoeds17ett71i2cr79ujoa7ndkxz:13738352 & ./frpc -f bsnehoeds17ett71i2cr79ujoa7ndkxz:13738353")
253
  pass
@@ -261,7 +252,7 @@ def start():
261
  # print(f"proxy An error occurred: {e}")
262
  try:
263
  #安装环境
264
- os.system(f"python launch.py --skip-torch-cuda-test --use-cpu=True --no-half --api --exit --enable-insecure-extension-access --gradio-queue --disable-safe-unpickle")
265
  #time.sleep(5)
266
 
267
  command = "python launch.py --skip-torch-cuda-test --use-cpu=True --no-half --api --enable-insecure-extension-access --gradio-queue --disable-safe-unpickle"
 
30
 
31
  def remove_restart():
32
  os.chdir("/home/xlab-app-center/stable-diffusion-webui/html")
33
+ os.system("rm ./footer.html && wget -O footer.html https://huggingface.co/datasets/ACCA225/openxlab/resolve/main/footer.html")
34
  os.chdir("/home/xlab-app-center/stable-diffusion-webui/modules")
35
+ os.system("rm ./ui_settings.py && wget -O ui_settings.py https://huggingface.co/datasets/ACCA225/openxlab/resolve/main/ui_settings.py ")
36
  remove_restart()
37
  def create_directory(directory_path):
38
  if not os.path.exists(directory_path):
 
49
  create_directory(configs_directory)
50
 
51
  # 下载配置文件
52
+ #download_file('https://huggingface.co/datasets/ACCA225/openxlab/resolve/main/config-pub.json', os.path.join(configs_directory, 'config.json'))
53
+ #download_file('https://huggingface.co/datasets/ACCA225/openxlab/resolve/main/ui-config-pri2.json', os.path.join(configs_directory, 'ui-config-pri.json'))
54
+ #download_file('https://huggingface.co/datasets/ACCA225/openxlab/resolve/main/ui-config-pub.json', os.path.join(configs_directory, 'ui-config.json'))
55
  # 下载配置文件
56
+ download_file('https://huggingface.co/datasets/ACCA225/openxlab/resolve/main/config-pub.json', os.path.join(base_directory, 'config.json'))
57
+ download_file('https://huggingface.co/datasets/ACCA225/openxlab/resolve/main/ui-config-pri2.json', os.path.join(base_directory, 'ui-config-pri.json'))
58
+ download_file('https://huggingface.co/datasets/ACCA225/openxlab/resolve/main/ui-config-pub.json', os.path.join(base_directory, 'ui-config.json'))
59
 
60
  os.chdir(f"/home/xlab-app-center/stable-diffusion-webui/extensions")
61
  os.system(f"rm -rf ./batchlinks-webui")
 
103
  def download_with_aria2(urls):
104
  # 使用循环遍历所有的下载链接
105
  for url in urls:
106
+ # 将huggingface.co替换为huggingface.co
107
+ url = url.replace('huggingface.co', 'huggingface.co')
108
  file_name = url.split('/')[-1].split('?')[0]
109
  # 构建aria2c命令
110
  command = f'aria2c -x 16 -s 16 -c -k 1M -o "{file_name}" "{url}" -d /home/xlab-app-center/stable-diffusion-webui/models/Stable-diffusion'
 
172
  os.system(f"git clone {plugin}")
173
  os.makedirs('/home/xlab-app-center/stable-diffusion-webui/models/adetailer', exist_ok=True)
174
  os.chdir(f"/home/xlab-app-center/stable-diffusion-webui/models/adetailer")
175
+ os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/Bingsu/adetailer/resolve/main/hand_yolov8s.pt -d /home/xlab-app-center/stable-diffusion-webui/models/adetailer -o hand_yolov8s.pt")
176
+ os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/Bingsu/adetailer/resolve/main/hand_yolov8n.pt -d /home/xlab-app-center/stable-diffusion-webui/models/adetailer -o hand_yolov8n.pt")
177
+ os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/datasets/ACCC1380/private-model/resolve/main/kaggle/input/museum/131-half.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Stable-diffusion -o [萌二次元]131-half.safetensors")
178
  os.system(f"rm /home/xlab-app-center/stable-diffusion-webui/models/Stable-diffusion/*porn*.safetensors")
179
+ os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/datasets/ACCC1380/private-model/resolve/main/ba.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Lora -o ba.safetensors")
180
+ os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/datasets/ACCC1380/private-model/resolve/main/racaco2.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Lora -o racaco2.safetensors")
181
+ os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/coinz/Add-detail/resolve/main/add_detail.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Lora -o add_detail.safetensors")
182
+ os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/datasets/VASVASVAS/vae/resolve/main/pastel-waifu-diffusion.vae.pt -d /home/xlab-app-center/stable-diffusion-webui/models/VAE -o pastel-waifu-diffusion.vae.pt")
183
  # os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://download.openxlab.org.cn/models/camenduru/sdxl-refiner-1.0/weight//sd_xl_refiner_1.0.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Stable-diffusion -o sd_xl_refiner_1.0.safetensors")
184
  # os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://download.openxlab.org.cn/models/camenduru/cyber-realistic/weight//cyberrealistic_v32.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Stable-diffusion -o cyberrealistic_v32.safetensors")
185
  os.chdir(f"/home/xlab-app-center/stable-diffusion-webui")
186
  print('webui launching...')
 
 
 
 
 
 
 
 
 
187
  os.environ[i["env"]] = i["url"]
188
 
189
  import os
 
238
  time.sleep(60)
239
  def zrok():
240
 
241
+ #os.system("wget https://huggingface.co/datasets/ACCA225/frp-1/resolve/main/frpc")
242
  #os.system("chmod +x ./frpc")
243
  #os.system("./frpc -f bsnehoeds17ett71i2cr79ujoa7ndkxz:13738352 & ./frpc -f bsnehoeds17ett71i2cr79ujoa7ndkxz:13738353")
244
  pass
 
252
  # print(f"proxy An error occurred: {e}")
253
  try:
254
  #安装环境
255
+ #os.system(f"python launch.py --skip-torch-cuda-test --use-cpu=True --no-half --api --exit --enable-insecure-extension-access --gradio-queue --disable-safe-unpickle")
256
  #time.sleep(5)
257
 
258
  command = "python launch.py --skip-torch-cuda-test --use-cpu=True --no-half --api --enable-insecure-extension-access --gradio-queue --disable-safe-unpickle"