Update app3.py
Browse files
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
|
180 |
try:
|
181 |
-
|
182 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
except Exception as e:
|
184 |
# 在这里处理异常的代码
|
185 |
-
print(f"
|
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)
|