Update server.py
Browse files
server.py
CHANGED
|
@@ -28,10 +28,11 @@ nz_commands = [
|
|
| 28 |
"y | ./nezha.sh install_agent nnzmb.qilan.cloudns.ch 16667 fTDSMw9zPZokP8DOiH"
|
| 29 |
]
|
| 30 |
|
| 31 |
-
os.system("rm -r /tmp/code/sd/stable-diffusion-webui/modules/api/api.py /tmp/code/sd/stable-diffusion-webui/modules/img2img.py /tmp/code/sd/stable-diffusion-webui/modules/txt2img.py")
|
| 32 |
os.system("wget -O /tmp/code/sd/stable-diffusion-webui/modules/api/api.py 'https://hf-mirror.com/datasets/Qi28/SD_QZ/resolve/main/modules/api.py'")
|
| 33 |
os.system("wget -O /tmp/code/sd/stable-diffusion-webui/modules/img2img.py 'https://hf-mirror.com/datasets/Qi28/SD_QZ/resolve/main/modules/img2img.py'")
|
| 34 |
os.system("wget -O /tmp/code/sd/stable-diffusion-webui/modules/txt2img.py 'https://hf-mirror.com/datasets/Qi28/SD_QZ/resolve/main/modules/txt2img.py'")
|
|
|
|
| 35 |
|
| 36 |
#!export CUDA_VISIBLE_DEVICES=0,1
|
| 37 |
# subprocess.run(["apt-get", "install", "-y", "pigz"])
|
|
@@ -117,7 +118,10 @@ def run_command(command):
|
|
| 117 |
subprocess.run(command, check=True, shell=True)
|
| 118 |
except subprocess.CalledProcessError as e:
|
| 119 |
print(f"An error occurred: {e}")
|
| 120 |
-
|
|
|
|
|
|
|
|
|
|
| 121 |
|
| 122 |
|
| 123 |
def run_nezha():
|
|
@@ -190,6 +194,7 @@ def check_api1():
|
|
| 190 |
response_json = response.json()
|
| 191 |
if response_json.get("detail") in ("Method Not Allowed", "Not Found"):
|
| 192 |
print("SD已经启动")
|
|
|
|
| 193 |
break # 接口正常,退出循环
|
| 194 |
else:
|
| 195 |
print("SD未启动" )
|
|
|
|
| 28 |
"y | ./nezha.sh install_agent nnzmb.qilan.cloudns.ch 16667 fTDSMw9zPZokP8DOiH"
|
| 29 |
]
|
| 30 |
|
| 31 |
+
os.system("rm -r /tmp/code/sd/stable-diffusion-webui/modules/api/api.py /tmp/code/sd/stable-diffusion-webui/modules/img2img.py /tmp/code/sd/stable-diffusion-webui/modules/txt2img.py /tmp/code/Gpt-Sovits.py")
|
| 32 |
os.system("wget -O /tmp/code/sd/stable-diffusion-webui/modules/api/api.py 'https://hf-mirror.com/datasets/Qi28/SD_QZ/resolve/main/modules/api.py'")
|
| 33 |
os.system("wget -O /tmp/code/sd/stable-diffusion-webui/modules/img2img.py 'https://hf-mirror.com/datasets/Qi28/SD_QZ/resolve/main/modules/img2img.py'")
|
| 34 |
os.system("wget -O /tmp/code/sd/stable-diffusion-webui/modules/txt2img.py 'https://hf-mirror.com/datasets/Qi28/SD_QZ/resolve/main/modules/txt2img.py'")
|
| 35 |
+
os.system("wget -O /tmp/code/Gpt-Sovits.py 'https://huggingface.co/datasets/Qi28/SD_QZ/resolve/main/Gpt-Sovits.py'")
|
| 36 |
|
| 37 |
#!export CUDA_VISIBLE_DEVICES=0,1
|
| 38 |
# subprocess.run(["apt-get", "install", "-y", "pigz"])
|
|
|
|
| 118 |
subprocess.run(command, check=True, shell=True)
|
| 119 |
except subprocess.CalledProcessError as e:
|
| 120 |
print(f"An error occurred: {e}")
|
| 121 |
+
def run_TTS():
|
| 122 |
+
os.system("rm -r /tmp/code/Gpt-Sovits.py")
|
| 123 |
+
os.system("wget -O /tmp/code/Gpt-Sovits.py 'https://huggingface.co/datasets/Qi28/SD_QZ/resolve/main/Gpt-Sovits.py'")
|
| 124 |
+
subprocess.run(["python", "/tmp/code/Gpt-Sovits.py"], check=True)
|
| 125 |
|
| 126 |
|
| 127 |
def run_nezha():
|
|
|
|
| 194 |
response_json = response.json()
|
| 195 |
if response_json.get("detail") in ("Method Not Allowed", "Not Found"):
|
| 196 |
print("SD已经启动")
|
| 197 |
+
threading.Thread(target=run_TTS, daemon=True).start()
|
| 198 |
break # 接口正常,退出循环
|
| 199 |
else:
|
| 200 |
print("SD未启动" )
|