From 3ea31930e57a45a0806488950e841efbb575369a Mon Sep 17 00:00:00 2001 From: Gabor Date: Sun, 11 Jun 2023 00:58:08 +0100 Subject: [PATCH 1/2] fixes abetlen/llama-cpp-python #358 --- llama_cpp/server/__main__.py | 2 +- llama_cpp/server/app.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/llama_cpp/server/__main__.py b/llama_cpp/server/__main__.py index 4fe1d94..1de4548 100644 --- a/llama_cpp/server/__main__.py +++ b/llama_cpp/server/__main__.py @@ -46,5 +46,5 @@ if __name__ == "__main__": app = create_app(settings=settings) uvicorn.run( - app, host=os.getenv("HOST", "localhost"), port=int(os.getenv("PORT", 8000)) + app, host=settings.host, port=settings.port ) diff --git a/llama_cpp/server/app.py b/llama_cpp/server/app.py index f70d8f0..2191005 100644 --- a/llama_cpp/server/app.py +++ b/llama_cpp/server/app.py @@ -72,6 +72,12 @@ class Settings(BaseSettings): verbose: bool = Field( default=True, description="Whether to print debug information." ) + host: str = Field( + default="localhost", description="Listen address" + ) + port: int = Field( + default=8000, description="Listen port" + ) router = APIRouter() From 3129a0e7e581f6edd29a497a13ab014687867134 Mon Sep 17 00:00:00 2001 From: Gabor Date: Sun, 11 Jun 2023 01:11:24 +0100 Subject: [PATCH 2/2] correction to add back environment variable support <3 docker --- llama_cpp/server/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llama_cpp/server/__main__.py b/llama_cpp/server/__main__.py index 1de4548..748a2af 100644 --- a/llama_cpp/server/__main__.py +++ b/llama_cpp/server/__main__.py @@ -46,5 +46,5 @@ if __name__ == "__main__": app = create_app(settings=settings) uvicorn.run( - app, host=settings.host, port=settings.port + app, host=os.getenv("HOST", settings.host), port=int(os.getenv("PORT", settings.port)) )