feat: deploy langflow using langchain-serve

This commit is contained in:
Deepankar Mahapatro 2023-05-15 17:48:02 +05:30
commit 52093240b1
5 changed files with 57 additions and 0 deletions

View file

@ -69,6 +69,20 @@ def serve(
LangflowApplication(app, options).run()
@app.command()
def jcloud():
"""
Deploy Langflow server on Jina AI Cloud
"""
import os
from importlib.metadata import version as mod_version
app_name = "langflow.lcserve:app"
version = mod_version("langflow")
uses = f"jinaai+docker://langflow:{version}"
os.system(f"lc-serve deploy jcloud --app {app_name} --app-dir . --uses {uses}")
def main():
app()

View file

@ -0,0 +1,14 @@
# This file is used by lc-serve to load the mounted app and serve it.
from pathlib import Path
from fastapi.staticfiles import StaticFiles
from langflow.main import create_app
app = create_app()
path = Path(__file__).parent
static_files_dir = path / "frontend"
app.mount(
"/",
StaticFiles(directory=static_files_dir, html=True),
name="static",
)