Merge branch 'dev' of https://github.com/logspace-ai/langflow into dev
This commit is contained in:
commit
ffe5989bce
1 changed files with 23 additions and 8 deletions
|
|
@ -1,11 +1,20 @@
|
|||
import multiprocessing
|
||||
import os
|
||||
import platform
|
||||
|
||||
from langflow_backend.main import create_app
|
||||
|
||||
import typer
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from pathlib import Path
|
||||
|
||||
from langflow_backend.server import LangflowApplication
|
||||
|
||||
def get_number_of_workers(workers=None):
|
||||
if workers is None:
|
||||
workers = 1
|
||||
elif workers == -1:
|
||||
workers = (multiprocessing.cpu_count() * 2) + 1
|
||||
return workers
|
||||
|
||||
|
||||
def serve(
|
||||
|
|
@ -21,22 +30,28 @@ def serve(
|
|||
StaticFiles(directory=static_files_dir, html=True),
|
||||
name="static",
|
||||
)
|
||||
if not workers:
|
||||
workers = 1
|
||||
elif workers == -1:
|
||||
workers = (multiprocessing.cpu_count() * 2) + 1
|
||||
|
||||
if not timeout:
|
||||
timeout = 60
|
||||
|
||||
host = "127.0.0.1"
|
||||
port = 5003
|
||||
options = {
|
||||
"bind": "127.0.0.1:5003",
|
||||
"workers": workers,
|
||||
"bind": f"{host}:{port}",
|
||||
"workers": get_number_of_workers(workers),
|
||||
"worker_class": "uvicorn.workers.UvicornWorker",
|
||||
"timeout": timeout,
|
||||
}
|
||||
|
||||
LangflowApplication(app, options).run()
|
||||
if platform.system() == "Darwin":
|
||||
# Run using uvicorn on MacOS
|
||||
import uvicorn
|
||||
|
||||
uvicorn.run(app, host=host, port=port, log_level="info")
|
||||
else:
|
||||
from langflow_backend.server import LangflowApplication
|
||||
|
||||
LangflowApplication(app, options).run()
|
||||
|
||||
|
||||
def main():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue