From d70291d2c590acee654c3bbdea35a6104d9a25c3 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Sun, 5 Mar 2023 21:55:44 +0000 Subject: [PATCH] feat: add port option to cli --- langflow/cli.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/langflow/cli.py b/langflow/cli.py index 5837bd111..99805b3e5 100644 --- a/langflow/cli.py +++ b/langflow/cli.py @@ -1,24 +1,23 @@ +from langflow.backend.app import create_app + import typer +import uvicorn from fastapi.staticfiles import StaticFiles from pathlib import Path -from langflow.backend.app import create_app - -# get the directory of the current file -path = Path(__file__).parent -static_files_dir = path / "frontend/build" app = create_app() -app.mount( - "/", - StaticFiles(directory=static_files_dir, html=True), - name="static", -) def serve(port: int = 5003): - import uvicorn - - uvicorn.run(app, host="localhost", port=port) + # get the directory of the current file + path = Path(__file__).parent + static_files_dir = path / "frontend/build" + app.mount( + "/", + StaticFiles(directory=static_files_dir, html=True), + name="static", + ) + uvicorn.run(app, port=port) def main():