mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Merge branch 'cgodley-web-host-port' into development
This commit is contained in:
commit
d0df894c9f
@ -99,7 +99,7 @@ def main():
|
|||||||
|
|
||||||
cmd_parser = create_cmd_parser()
|
cmd_parser = create_cmd_parser()
|
||||||
if opt.web:
|
if opt.web:
|
||||||
dream_server_loop(t2i)
|
dream_server_loop(t2i, opt.host, opt.port)
|
||||||
else:
|
else:
|
||||||
main_loop(t2i, opt.outdir, opt.prompt_as_dir, cmd_parser, infile)
|
main_loop(t2i, opt.outdir, opt.prompt_as_dir, cmd_parser, infile)
|
||||||
|
|
||||||
@ -310,7 +310,7 @@ def get_next_command(infile=None) -> str: #command string
|
|||||||
print(f'#{command}')
|
print(f'#{command}')
|
||||||
return command
|
return command
|
||||||
|
|
||||||
def dream_server_loop(t2i):
|
def dream_server_loop(t2i, host, port):
|
||||||
print('\n* --web was specified, starting web server...')
|
print('\n* --web was specified, starting web server...')
|
||||||
# Change working directory to the stable-diffusion directory
|
# Change working directory to the stable-diffusion directory
|
||||||
os.chdir(
|
os.chdir(
|
||||||
@ -319,9 +319,13 @@ def dream_server_loop(t2i):
|
|||||||
|
|
||||||
# Start server
|
# Start server
|
||||||
DreamServer.model = t2i
|
DreamServer.model = t2i
|
||||||
dream_server = ThreadingDreamServer(("0.0.0.0", 9090))
|
dream_server = ThreadingDreamServer((host, port))
|
||||||
print("\nStarted Stable Diffusion dream server!")
|
print(">> Started Stable Diffusion dream server!")
|
||||||
print("Point your browser at http://localhost:9090 or use the host's DNS name or IP address.")
|
if host == '0.0.0.0':
|
||||||
|
print(f"Point your browser at http://localhost:{port} or use the host's DNS name or IP address.")
|
||||||
|
else:
|
||||||
|
print(">> Default host address now 127.0.0.1 (localhost). Use --host 0.0.0.0 to bind any address.")
|
||||||
|
print(f">> Point your browser at http://{host}:{port}.")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
dream_server.serve_forever()
|
dream_server.serve_forever()
|
||||||
@ -457,6 +461,18 @@ def create_argv_parser():
|
|||||||
action='store_true',
|
action='store_true',
|
||||||
help='Start in web server mode.',
|
help='Start in web server mode.',
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--host',
|
||||||
|
type=str,
|
||||||
|
default='127.0.0.1',
|
||||||
|
help='Web server: Host or IP to listen on. Set to 0.0.0.0 to accept traffic from other devices on your network.'
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--port',
|
||||||
|
type=int,
|
||||||
|
default='9090',
|
||||||
|
help='Web server: Port to listen on'
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--weights',
|
'--weights',
|
||||||
default='model',
|
default='model',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user