Spaces:
Build error
Build error
ian
commited on
Commit
·
52f5630
1
Parent(s):
94cf162
update
Browse files- README.md +1 -1
- flowsettings.py +17 -23
README.md
CHANGED
@@ -5,7 +5,7 @@ short_description: Chat with your documents
|
|
5 |
colorFrom: green
|
6 |
colorTo: indigo
|
7 |
sdk: gradio
|
8 |
-
sdk_version: 4.
|
9 |
app_file: app.py
|
10 |
pinned: true
|
11 |
license: apache-2.0
|
|
|
5 |
colorFrom: green
|
6 |
colorTo: indigo
|
7 |
sdk: gradio
|
8 |
+
sdk_version: 4.29.0
|
9 |
app_file: app.py
|
10 |
pinned: true
|
11 |
license: apache-2.0
|
flowsettings.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import os
|
|
|
2 |
from inspect import currentframe, getframeinfo
|
3 |
from pathlib import Path
|
4 |
|
@@ -11,6 +12,17 @@ if cur_frame is None:
|
|
11 |
this_file = getframeinfo(cur_frame).filename
|
12 |
this_dir = Path(this_file).parent
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
# App can be ran from anywhere and it's not trivial to decide where to store app data.
|
15 |
# So let's use the same directory as the flowsetting.py file.
|
16 |
KH_APP_DATA_DIR = this_dir / "ktem_app_data"
|
@@ -20,11 +32,14 @@ KH_APP_DATA_DIR.mkdir(parents=True, exist_ok=True)
|
|
20 |
KH_USER_DATA_DIR = KH_APP_DATA_DIR / "user_data"
|
21 |
KH_USER_DATA_DIR.mkdir(parents=True, exist_ok=True)
|
22 |
|
|
|
|
|
|
|
23 |
# HF models can be big, let's store them in the app data directory so that it's easier
|
24 |
# for users to manage their storage.
|
25 |
# ref: https://huggingface.co/docs/huggingface_hub/en/guides/manage-cache
|
26 |
-
|
27 |
-
|
28 |
|
29 |
COHERE_API_KEY = config("COHERE_API_KEY", default="")
|
30 |
KH_MODE = "dev"
|
@@ -150,27 +165,6 @@ KH_VLM_ENDPOINT = "{0}/openai/deployments/{1}/chat/completions?api-version={2}".
|
|
150 |
config("OPENAI_API_VERSION", default=""),
|
151 |
)
|
152 |
|
153 |
-
# KH_LLMS["qwen_local"] = {
|
154 |
-
# "spec": {
|
155 |
-
# "__type__": "kotaemon.llms.LlamaCppChat",
|
156 |
-
# "repo_id": "Qwen/Qwen1.5-0.5B-Chat-GGUF",
|
157 |
-
# "filename": "qwen1_5-0_5b-chat-q5_k_m.gguf",
|
158 |
-
# },
|
159 |
-
# "default": False,
|
160 |
-
# "cost": 0,
|
161 |
-
# }
|
162 |
-
|
163 |
-
# KH_LLMS["qwen1.5"] = {
|
164 |
-
# "spec": {
|
165 |
-
# "__type__": "kotaemon.llms.LlamaCppChat",
|
166 |
-
# "repo_id": "Qwen/Qwen1.5-1.8B-Chat-GGUF",
|
167 |
-
# "filename": "qwen1_5-1_8b-chat-q5_k_m.gguf",
|
168 |
-
# "chat_format": "qwen",
|
169 |
-
# },
|
170 |
-
# "default": False,
|
171 |
-
# "cost": 0,
|
172 |
-
# }
|
173 |
-
|
174 |
|
175 |
SETTINGS_APP = {
|
176 |
"lang": {
|
|
|
1 |
import os
|
2 |
+
from importlib.metadata import version
|
3 |
from inspect import currentframe, getframeinfo
|
4 |
from pathlib import Path
|
5 |
|
|
|
12 |
this_file = getframeinfo(cur_frame).filename
|
13 |
this_dir = Path(this_file).parent
|
14 |
|
15 |
+
# change this if your app use a different name
|
16 |
+
KH_PACKAGE_NAME = "kotaemon_app"
|
17 |
+
|
18 |
+
KH_APP_VERSION = None
|
19 |
+
try:
|
20 |
+
# Caution: This might produce the wrong version
|
21 |
+
# https://stackoverflow.com/a/59533071
|
22 |
+
KH_APP_VERSION = version(KH_PACKAGE_NAME)
|
23 |
+
except Exception as e:
|
24 |
+
print(f"Failed to get app version: {e}")
|
25 |
+
|
26 |
# App can be ran from anywhere and it's not trivial to decide where to store app data.
|
27 |
# So let's use the same directory as the flowsetting.py file.
|
28 |
KH_APP_DATA_DIR = this_dir / "ktem_app_data"
|
|
|
32 |
KH_USER_DATA_DIR = KH_APP_DATA_DIR / "user_data"
|
33 |
KH_USER_DATA_DIR.mkdir(parents=True, exist_ok=True)
|
34 |
|
35 |
+
# doc directory
|
36 |
+
KH_DOC_DIR = this_dir / "docs"
|
37 |
+
|
38 |
# HF models can be big, let's store them in the app data directory so that it's easier
|
39 |
# for users to manage their storage.
|
40 |
# ref: https://huggingface.co/docs/huggingface_hub/en/guides/manage-cache
|
41 |
+
os.environ["HF_HOME"] = str(KH_APP_DATA_DIR / "huggingface")
|
42 |
+
os.environ["HF_HUB_CACHE"] = str(KH_APP_DATA_DIR / "huggingface")
|
43 |
|
44 |
COHERE_API_KEY = config("COHERE_API_KEY", default="")
|
45 |
KH_MODE = "dev"
|
|
|
165 |
config("OPENAI_API_VERSION", default=""),
|
166 |
)
|
167 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
|
169 |
SETTINGS_APP = {
|
170 |
"lang": {
|