Upload su3.py
Browse files
su3.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import shutil
|
3 |
+
import subprocess
|
4 |
+
print("\033[33m欢迎使用阿里云SD一键部署服务!预计时长5分钟,请耐心等待\033[0m")
|
5 |
+
subprocess.run(["python3", "-m", "pip", "install", "--upgrade", "pip"])
|
6 |
+
subprocess.run(["apt", "update"])
|
7 |
+
subprocess.run(["apt", "install", "-y", "aria2"])
|
8 |
+
subprocess.run(["apt-get", "install", "sudo"])
|
9 |
+
subprocess.run(["sudo", "apt", "install", "p7zip-full", "-y"])
|
10 |
+
print("\n\n\n\n\033[33m开始下载 stable-diffusion-webui.zip\033[0m")
|
11 |
+
def aria2(url, filename, d):
|
12 |
+
subprocess.run(["aria2c", "--console-log-level=error", "-c", "-x", "16", "-s", "16", url, "-o", filename, "-d", d])
|
13 |
+
url = "https://modelscope.cn/models/dong625/webui-sd3/resolve/master/stable-diffusion-webui.zip"
|
14 |
+
aria2(url, "stable-diffusion-webui.zip", "/mnt")
|
15 |
+
subprocess.run([
|
16 |
+
"7z", "x", "-pQQ917724495", "/mnt/stable-diffusion-webui.zip",
|
17 |
+
"-o/mnt/workspace", "-y"
|
18 |
+
])
|
19 |
+
os.remove("/mnt/stable-diffusion-webui.zip")
|
20 |
+
os.chdir("/mnt/workspace/stable-diffusion-webui")
|
21 |
+
subprocess.run([
|
22 |
+
"pip", "install", "-r", "requirements_versions.txt",
|
23 |
+
"--extra-index-url", "https://download.pytorch.org/whl/cu117"
|
24 |
+
])
|
25 |
+
subprocess.run(["python", "move.py"])
|
26 |
+
if __name__ == "__main__":
|
27 |
+
print("\n\n\n\n\033[32m\033[4mSD服务部署成功!请点击左侧界面启动SD服务!\033[0m")
|
28 |
+
os.remove(__file__)
|