File size: 761 Bytes
d5868ac 57d969e 48732d6 57d969e d5868ac bb5b380 d5868ac 57d969e 8a67724 d5868ac bb5b380 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
import os
import subprocess
import sys
def on_start():
print("---------------")
print("Running script './on_start.sh' to download models ...")
print("---------------")
result = subprocess.run("./on_start.sh", shell=True, env=os.environ)
if result.returncode != 0:
raise RuntimeError(f"Error executing ./on_start.sh [exit code: {result.returncode}]")
def start():
on_start()
print("---------------")
print(f"Launching {'API server' if '--nowebui' in sys.argv else 'Web UI'} with arguments: {' '.join(sys.argv[1:])}")
print("---------------")
import webui # type: ignore # noqa
if '--nowebui' in sys.argv:
webui.api_only()
else:
webui.webui()
if __name__ == "__main__":
start()
|