Skip to content

Commit

Permalink
feat: espose Gradio share to env
Browse files Browse the repository at this point in the history
  • Loading branch information
taprosoft committed Jan 21, 2025
1 parent c5d3247 commit 593cff6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
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:
Expand All @@ -21,4 +22,5 @@
"libs/ktem/ktem/assets",
GRADIO_TEMP_DIR,
],
share=KH_GRADIO_SHARE,
)
1 change: 1 addition & 0 deletions flowsettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
except Exception:
KH_APP_VERSION = "local"

KH_GRADIO_SHARE = config("KH_GRADIO_SHARE", default=False, cast=bool)
KH_ENABLE_FIRST_SETUP = config("KH_ENABLE_FIRST_SETUP", default=True, cast=bool)
KH_DEMO_MODE = config("KH_DEMO_MODE", default=False, cast=bool)
KH_OLLAMA_URL = config("KH_OLLAMA_URL", default="http://localhost:11434/v1/")
Expand Down
8 changes: 4 additions & 4 deletions libs/ktem/ktem/pages/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,12 @@ def update_model(
)
elif radio_model_value == "ollama":
llms.update(
name="ollama-long-context",
name="ollama",
spec={
"__type__": "kotaemon.llms.LCOllamaChat",
"base_url": KH_OLLAMA_URL.replace("v1/", ""),
"__type__": "kotaemon.llms.ChatOpenAI",
"base_url": KH_OLLAMA_URL,
"model": config("LOCAL_MODEL", default="qwen2.5:7b"),
"num_ctx": 8192,
"api_key": "ollama",
},
default=True,
)
Expand Down

0 comments on commit 593cff6

Please sign in to comment.