Add --nowebui flag for pure API mode (#4651)

This commit is contained in:
oobabooga 2023-11-18 23:38:39 -03:00 committed by GitHub
parent 0fa1af296c
commit ef6feedeb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 11 deletions

View file

@ -226,13 +226,19 @@ if __name__ == "__main__":
shared.generation_lock = Lock()
# Launch the web UI
create_interface()
while True:
time.sleep(0.5)
if shared.need_restart:
shared.need_restart = False
if shared.args.nowebui:
# Start the API in standalone mode
shared.args.extensions = [x for x in shared.args.extensions if x != 'gallery']
if shared.args.extensions is not None and len(shared.args.extensions) > 0:
extensions_module.load_extensions()
else:
# Launch the web UI
create_interface()
while True:
time.sleep(0.5)
shared.gradio['interface'].close()
time.sleep(0.5)
create_interface()
if shared.need_restart:
shared.need_restart = False
time.sleep(0.5)
shared.gradio['interface'].close()
time.sleep(0.5)
create_interface()