|
import os |
|
import shutil |
|
import subprocess |
|
print("\033[33m欢迎使用阿里云SD一键部署服务!预计时长5分钟,请耐心等待\033[0m") |
|
subprocess.run(["python3", "-m", "pip", "install", "--upgrade", "pip"]) |
|
subprocess.run(["apt", "update"]) |
|
subprocess.run(["apt", "install", "-y", "aria2"]) |
|
subprocess.run(["apt-get", "install", "sudo"]) |
|
subprocess.run(["sudo", "apt", "install", "p7zip-full", "-y"]) |
|
print("\n\n\n\n\033[33m开始下载 stable-diffusion-webui.zip\033[0m") |
|
def aria2(url, filename, d): |
|
subprocess.run(["aria2c", "--console-log-level=error", "-c", "-x", "16", "-s", "16", url, "-o", filename, "-d", d]) |
|
url = "https://www.modelscope.cn/api/v1/models/dong625/stable-diffusion-webui/repo?Revision=master&FilePath=stable-diffusion-webui.zip" |
|
aria2(url, "stable-diffusion-webui.zip", "/mnt") |
|
subprocess.run([ |
|
"7z", "x", "-pQQ917724495", "/mnt/stable-diffusion-webui.zip", |
|
"-o/mnt/workspace", "-y" |
|
]) |
|
os.remove("/mnt/stable-diffusion-webui.zip") |
|
os.chdir("/mnt/workspace/stable-diffusion-webui") |
|
subprocess.run([ |
|
"pip", "install", "-r", "requirements_versions.txt", |
|
"--extra-index-url", "https://download.pytorch.org/whl/cu117" |
|
]) |
|
subprocess.run(["python", "move.py"]) |
|
if __name__ == "__main__": |
|
print("\n\n\n\n\033[32m\033[4mSD服务部署成功!请点击左侧界面启动SD服务!\033[0m") |
|
os.remove(__file__) |