su / sd3_launch.py
dong625's picture
Update sd3_launch.py
cfb2bdd verified
raw
history blame
3.13 kB
import os
from modules import launch_utils
import shutil
args = launch_utils.args
python = launch_utils.python
git = launch_utils.git
index_url = launch_utils.index_url
dir_repos = launch_utils.dir_repos
commit_hash = launch_utils.commit_hash
git_tag = launch_utils.git_tag
run = launch_utils.run
is_installed = launch_utils.is_installed
repo_dir = launch_utils.repo_dir
run_pip = launch_utils.run_pip
check_run_python = launch_utils.check_run_python
git_clone = launch_utils.git_clone
git_pull_recursive = launch_utils.git_pull_recursive
list_extensions = launch_utils.list_extensions
run_extension_installer = launch_utils.run_extension_installer
prepare_environment = launch_utils.prepare_environment
configure_for_tests = launch_utils.configure_for_tests
start = launch_utils.start
def main():
if os.path.exists("/mnt/workspace/stable-diffusion-webui/modules"):
shutil.rmtree("/mnt/workspace/stable-diffusion-webui/modules")
if args.dump_sysinfo:
filename = launch_utils.dump_sysinfo()
print(f"Sysinfo saved as {filename}. Exiting...")
exit(0)
import requests
def get_daily_sentence(types=['a']):
params = {
'c': types
}
response = requests.get("https://v1.hitokoto.cn/", params=params)
if response.status_code == 200:
data = response.json()
return "\033[36m\033[4m" + data["hitokoto"] + "\033[0m"
else:
return " \033[36m\033[4m静待花开会有时,守得云开见月明\033[0m"
daily_sentence = get_daily_sentence(['i',])
def count_execution():
if not os.path.exists("/mnt/workspace/stable-diffusion-webui/count.txt"):
with open("/mnt/workspace/stable-diffusion-webui/count.txt", "w") as f:
f.write("0")
with open("/mnt/workspace/stable-diffusion-webui/count.txt", "r") as f:
count = int(f.read())
count += 1
with open("/mnt/workspace/stable-diffusion-webui/count.txt", "w") as f:
f.write(str(count))
return count
count=count_execution()
if(count<3):
print("version SD3")
print(f"这是您在本实例中第{count}次启动SD")
print("👇请往下滑点击蓝色的\033[34m http:\\\\0.0.0.0:6666\033[0m 打开SD界面👇")
if(count>2):
print(daily_sentence)
print("version SD3")
print(f"这是您在本实例中第{count}次启动SD")
print("SD服务启动中,如在使用过程中有任何问题,请联系VX:H917724495")
if os.path.exists("/mnt/workspace/Untitled.ipynb"):
os.remove("/mnt/workspace/Untitled.ipynb")
if os.path.exists("/mnt/workspace/不会用点我.jpg"):
os.remove("/mnt/workspace/不会用点我.jpg")
launch_utils.startup_timer.record("initial startup")
with launch_utils.startup_timer.subcategory("prepare environment"):
if not args.skip_prepare_environment:
prepare_environment()
if args.test_server:
configure_for_tests()
start()
if __name__ == "__main__":
main()