Update su.py
Browse files
su.py
CHANGED
@@ -1,53 +1,28 @@
|
|
1 |
import os
|
2 |
import shutil
|
3 |
import subprocess
|
4 |
-
|
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 |
-
|
11 |
-
os.system("git lfs install")
|
12 |
-
|
13 |
-
print("开始下载 stable-diffusion-webui.zip")
|
14 |
def aria2(url, filename, d):
|
15 |
subprocess.run(["aria2c", "--console-log-level=error", "-c", "-x", "16", "-s", "16", url, "-o", filename, "-d", d])
|
16 |
url = "https://www.modelscope.cn/api/v1/models/dong625/stable-diffusion-webui/repo?Revision=master&FilePath=stable-diffusion-webui.zip"
|
17 |
-
aria2(url, "stable-diffusion-webui.zip", "/mnt
|
18 |
-
#"https://hf-mirror.com/dong625/stable-diffusion-webui/resolve/main/stable-diffusion-webui.zip"
|
19 |
subprocess.run([
|
20 |
-
"7z", "x", "-pQQ917724495", "/mnt/
|
21 |
"-o/mnt/workspace", "-y"
|
22 |
])
|
23 |
-
os.remove("/mnt/
|
24 |
-
|
25 |
os.chdir("/mnt/workspace/stable-diffusion-webui")
|
26 |
subprocess.run([
|
27 |
"pip", "install", "-r", "requirements_versions.txt",
|
28 |
"--extra-index-url", "https://download.pytorch.org/whl/cu117"
|
29 |
])
|
30 |
-
|
31 |
-
def move_files():
|
32 |
-
source_files = [
|
33 |
-
"/mnt/workspace/stable-diffusion-webui/点我启动SD.ipynb",
|
34 |
-
"/mnt/workspace/stable-diffusion-webui/下载大模型点这里.ipynb",
|
35 |
-
"/mnt/workspace/stable-diffusion-webui/下载Lora点这里.ipynb",
|
36 |
-
"/mnt/workspace/stable-diffusion-webui/Photo",
|
37 |
-
"/mnt/workspace/stable-diffusion-webui/更多服务点我",
|
38 |
-
]
|
39 |
-
destination_dir = "/mnt/workspace/"
|
40 |
-
for file_path in source_files:
|
41 |
-
if os.path.exists(file_path):
|
42 |
-
try:
|
43 |
-
shutil.move(file_path, destination_dir)
|
44 |
-
pass
|
45 |
-
except Exception as e:
|
46 |
-
pass
|
47 |
-
else:
|
48 |
-
pass
|
49 |
-
|
50 |
if __name__ == "__main__":
|
51 |
-
|
52 |
-
print("\033[32m\033[4mSD服务部署成功!请点击左侧界面启动SD服务!\033[0m")
|
53 |
os.remove(__file__)
|
|
|
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://www.modelscope.cn/api/v1/models/dong625/stable-diffusion-webui/repo?Revision=master&FilePath=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__)
|