From 26cf8c2545dead5a9179289a7f3c415926b12c09 Mon Sep 17 00:00:00 2001 From: atriantafy Date: Tue, 16 May 2023 00:44:16 +0100 Subject: [PATCH] add api port options (#1990) --- extensions/api/script.py | 8 ++------ modules/shared.py | 2 ++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/extensions/api/script.py b/extensions/api/script.py index 3911b106..5544de72 100644 --- a/extensions/api/script.py +++ b/extensions/api/script.py @@ -2,10 +2,6 @@ import extensions.api.blocking_api as blocking_api import extensions.api.streaming_api as streaming_api from modules import shared -BLOCKING_PORT = 5000 -STREAMING_PORT = 5005 - - def setup(): - blocking_api.start_server(BLOCKING_PORT, share=shared.args.public_api) - streaming_api.start_server(STREAMING_PORT, share=shared.args.public_api) + blocking_api.start_server(shared.args.api_blocking_port, share=shared.args.public_api) + streaming_api.start_server(shared.args.api_streaming_port, share=shared.args.public_api) diff --git a/modules/shared.py b/modules/shared.py index ce128751..58ba6eaf 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -162,6 +162,8 @@ parser.add_argument("--gradio-auth-path", type=str, help='Set the gradio authent # API parser.add_argument('--api', action='store_true', help='Enable the API extension.') +parser.add_argument('--api-blocking-port', type=int, default=5000, help='The listening port for the blocking API.') +parser.add_argument('--api-streaming-port', type=int, default=5005, help='The listening port for the streaming API.') parser.add_argument('--public-api', action='store_true', help='Create a public URL for the API using Cloudfare.') # Multimodal