mirror of
https://github.com/Cinnamon/kotaemon.git
synced 2026-07-09 20:09:10 +02:00
32 lines
910 B
Python
32 lines
910 B
Python
import os
|
|
|
|
from theflow.settings import settings as flowsettings
|
|
|
|
KH_APP_DATA_DIR = getattr(flowsettings, "KH_APP_DATA_DIR", ".")
|
|
KH_GRADIO_SHARE = getattr(flowsettings, "KH_GRADIO_SHARE", False)
|
|
GRADIO_TEMP_DIR = os.getenv("GRADIO_TEMP_DIR", None)
|
|
# override GRADIO_TEMP_DIR if it's not set
|
|
if GRADIO_TEMP_DIR is None:
|
|
GRADIO_TEMP_DIR = os.path.join(KH_APP_DATA_DIR, "gradio_tmp")
|
|
os.environ["GRADIO_TEMP_DIR"] = GRADIO_TEMP_DIR
|
|
|
|
|
|
from ktem.main import App # noqa
|
|
|
|
app = App()
|
|
demo = app.make()
|
|
queue_kwargs = {}
|
|
default_concurrency_limit = os.getenv("KH_GRADIO_DEFAULT_CONCURRENCY_LIMIT")
|
|
if default_concurrency_limit:
|
|
queue_kwargs["default_concurrency_limit"] = int(default_concurrency_limit)
|
|
|
|
demo.queue(**queue_kwargs).launch(
|
|
favicon_path=app._favicon,
|
|
inbrowser=True,
|
|
allowed_paths=[
|
|
"libs/ktem/ktem/assets",
|
|
GRADIO_TEMP_DIR,
|
|
],
|
|
share=KH_GRADIO_SHARE,
|
|
)
|