import os import subprocess import gradio as gr # Start Automatic1111 WebUI in background if not os.path.exists("stable-diffusion-webui"): subprocess.run([ "git", "clone", "--depth", "1", "https://github.com/AUTOMATIC1111/stable-diffusion-webui.git" ]) os.chdir("stable-diffusion-webui") # Install dependencies (will be picked up by requirements.txt too) subprocess.run(["pip", "install", "-r", "requirements.txt"]) # Launch WebUI os.environ["COMMANDLINE_ARGS"] = "--listen --xformers --enable-insecure-extension-access --medvram" subprocess.run(["python", "launch.py"])