add api port options (#1990)

This commit is contained in:
atriantafy 2023-05-16 00:44:16 +01:00 committed by GitHub
parent e657dd342d
commit 26cf8c2545
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -2,10 +2,6 @@ import extensions.api.blocking_api as blocking_api
import extensions.api.streaming_api as streaming_api import extensions.api.streaming_api as streaming_api
from modules import shared from modules import shared
BLOCKING_PORT = 5000
STREAMING_PORT = 5005
def setup(): def setup():
blocking_api.start_server(BLOCKING_PORT, share=shared.args.public_api) blocking_api.start_server(shared.args.api_blocking_port, share=shared.args.public_api)
streaming_api.start_server(STREAMING_PORT, share=shared.args.public_api) streaming_api.start_server(shared.args.api_streaming_port, share=shared.args.public_api)

View File

@ -162,6 +162,8 @@ parser.add_argument("--gradio-auth-path", type=str, help='Set the gradio authent
# API # API
parser.add_argument('--api', action='store_true', help='Enable the API extension.') 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.') parser.add_argument('--public-api', action='store_true', help='Create a public URL for the API using Cloudfare.')
# Multimodal # Multimodal