fix: Fix the issue of invalid port settings (#1351)

This commit is contained in:
2024-03-29 17:25:42 +08:00 committed by GitHub
parent a272d1b8f3
commit 4238a670bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 2 deletions

View File

@ -25,7 +25,7 @@ class Config(metaclass=Singleton):
# Gradio language version: en, zh
self.LANGUAGE = os.getenv("LANGUAGE", "en")
self.WEB_SERVER_PORT = int(os.getenv("WEB_SERVER_PORT", 7860))
self.WEB_SERVER_PORT = int(os.getenv("WEB_SERVER_PORT", 5000))
self.debug_mode = False
self.skip_reprompt = False

View File

@ -218,7 +218,7 @@ class WebServerParameters(BaseParameters):
default="0.0.0.0", metadata={"help": "Webserver deploy host"}
)
port: Optional[int] = field(
default=5000, metadata={"help": "Webserver deploy port"}
default=None, metadata={"help": "Webserver deploy port"}
)
daemon: Optional[bool] = field(
default=False, metadata={"help": "Run Webserver in background"}

View File

@ -140,6 +140,10 @@ def initialize_app(param: WebServerParameters = None, args: List[str] = None):
model_name = param.model_name or CFG.LLM_MODEL
param.model_name = model_name
param.port = param.port or CFG.WEB_SERVER_PORT
if not param.port:
param.port = 5000
print(param)
embedding_model_name = CFG.EMBEDDING_MODEL