ACCA225 commited on
Commit
13575e7
1 Parent(s): 9590c65

Update app3.py

Browse files
Files changed (1) hide show
  1. app3.py +14 -6
app3.py CHANGED
@@ -161,7 +161,7 @@ def check_service(host, port):
161
  def localProxy():
162
  os.system('sudo apt install nginx -y')
163
  download_file('https://huggingface.co/datasets/ACCA225/openxlab/resolve/main/proxy_nginx.conf', os.path.join(base_directory, 'proxy_nginx.conf'))
164
- run(f'''nginx -c /home/xlab-app-center/stable-diffusion-webui/proxy_nginx.conf''')
165
 
166
 
167
  import os
@@ -175,14 +175,22 @@ def start():
175
  print('启动proxy')
176
  threading.Thread(target = localProxy,daemon=True).start()
177
  except Exception as e:
178
- # 在这里处理异常的代码
179
- print(f"proxy An error occurred: {e}")
180
  try:
181
- os.system(f"python launch.py --skip-torch-cuda-test --use-cpu=True --no-half --api --xformers --enable-insecure-extension-access --ui-settings-file /home/xlab-app-center/config.json --ui-config-file /home/xlab-app-center/ui-config.json --gradio-queue --disable-safe-unpickle")
182
- #os.system(f"python launch.py --skip-torch-cuda-test --use-cpu=True --no-half --ngrok=2YypH9d2VXVL78HxF7g0lintH17_2GbtkFNFFngUkTZcyQ4SD --api --xformers --enable-insecure-extension-access --gradio-queue --disable-safe-unpickle & python launch.py --skip-torch-cuda-test --use-cpu=True --no-half --api --xformers --enable-insecure-extension-access --gradio-queue --disable-safe-unpickle --port=7862 & python launch.py --api --skip-torch-cuda-test --xformers --use-cpu=True --no-half --enable-insecure-extension-access --gradio-queue --disable-safe-unpickle --port=7863")
 
 
 
 
 
 
 
 
183
  except Exception as e:
184
  # 在这里处理异常的代码
185
- print(f"An error occurred: {e}")
186
  # Create threads for each function
187
 
188
  start_thread = threading.Thread(target=start)
 
161
  def localProxy():
162
  os.system('sudo apt install nginx -y')
163
  download_file('https://huggingface.co/datasets/ACCA225/openxlab/resolve/main/proxy_nginx.conf', os.path.join(base_directory, 'proxy_nginx.conf'))
164
+ run(f'''sudo nginx -c /home/xlab-app-center/stable-diffusion-webui/proxy_nginx.conf''')
165
 
166
 
167
  import os
 
175
  print('启动proxy')
176
  threading.Thread(target = localProxy,daemon=True).start()
177
  except Exception as e:
178
+ # # 在这里处理异常的代码
179
+ print(f"proxy 启动时发生重大错误: {e}")
180
  try:
181
+ #安装环境
182
+ os.system(f"python launch.py --api --xformers --exit --enable-insecure-extension-access --gradio-queue --disable-safe-unpickle")
183
+ #time.sleep(5)
184
+
185
+ command = "python launch.py --api --xformers --ui-settings-file /home/xlab-app-center/config.json --ui-config-file /home/xlab-app-center/ui-config.json --gradio-queue --disable-safe-unpickle"
186
+
187
+
188
+ process = subprocess.Popen(command, shell=True)
189
+ time.sleep(200)
190
+ #os.system(f"{command} --port=7861 --ngrok=2KPyfzQrHit97J02tARy1ckHJYd_69rJbgjpjnVVeuXD3j9tv ")
191
  except Exception as e:
192
  # 在这里处理异常的代码
193
+ print(f"启动SD发生错误: {e}")
194
  # Create threads for each function
195
 
196
  start_thread = threading.Thread(target=start)