Update su.py
Browse files
su.py
CHANGED
@@ -1,2 +1,44 @@
|
|
1 |
import os
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import os
|
2 |
+
import shutil
|
3 |
+
import subprocess
|
4 |
+
import modelscope
|
5 |
+
|
6 |
+
subprocess.run(["python3", "-m", "pip", "install", "--upgrade", "pip"])
|
7 |
+
subprocess.run(["apt", "update"])
|
8 |
+
subprocess.run(["apt", "install", "-y", "aria2"])
|
9 |
+
subprocess.run(["apt-get", "install", "sudo"])
|
10 |
+
subprocess.run(["sudo", "apt", "install", "p7zip-full", "-y"])
|
11 |
+
os.system("sudo apt-get install git-lfs")
|
12 |
+
os.system("git lfs install")
|
13 |
+
print("stable-diffusion-webui.zip")
|
14 |
+
os.system("git clone https://www.modelscope.cn/dong625/su.git")
|
15 |
+
os.rename("su","stable-diffusion-webui")
|
16 |
+
os.chdir("/mnt/workspace/stable-diffusion-webui")
|
17 |
+
subprocess.run([
|
18 |
+
"pip", "install", "-r", "requirements_versions.txt",
|
19 |
+
"--extra-index-url", "https://download.pytorch.org/whl/cu117"
|
20 |
+
])
|
21 |
+
|
22 |
+
def move_files():
|
23 |
+
source_files = [
|
24 |
+
"/mnt/workspace/stable-diffusion-webui/点我启动SD.ipynb",
|
25 |
+
"/mnt/workspace/stable-diffusion-webui/下载大模型点这里.ipynb",
|
26 |
+
"/mnt/workspace/stable-diffusion-webui/下载Lora点这里.ipynb",
|
27 |
+
"/mnt/workspace/stable-diffusion-webui/更多服务点我",
|
28 |
+
"/mnt/workspace/stable-diffusion-webui/Photo",
|
29 |
+
]
|
30 |
+
destination_dir = "/mnt/workspace/"
|
31 |
+
for file_path in source_files:
|
32 |
+
if os.path.exists(file_path):
|
33 |
+
try:
|
34 |
+
shutil.move(file_path, destination_dir)
|
35 |
+
pass
|
36 |
+
except Exception as e:
|
37 |
+
pass
|
38 |
+
else:
|
39 |
+
pass
|
40 |
+
|
41 |
+
if __name__ == "__main__":
|
42 |
+
move_files()
|
43 |
+
print("\033[32m\033[4mSD服务部署成功!请点击左侧界面启动SD服务!\033[0m")
|
44 |
+
os.remove(__file__)
|