Spaces:
Running
Running
shimizukawa
commited on
Commit
•
b6dd5cc
1
Parent(s):
240fe8a
Re: Update streamlit UI
Browse files
README.md
CHANGED
@@ -14,7 +14,7 @@ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-
|
|
14 |
|
15 |
# Required Environment variables
|
16 |
|
17 |
-
- `
|
18 |
- `QDRANT_URL`: Qdrant API endpoint
|
19 |
- `QDRANT_API_KEY`: Qdrant API Key
|
20 |
- `OPENAI_API_KEY`: OpenAI API Key
|
|
|
14 |
|
15 |
# Required Environment variables
|
16 |
|
17 |
+
- `INDEX_NAMES`: comma separated index names
|
18 |
- `QDRANT_URL`: Qdrant API endpoint
|
19 |
- `QDRANT_API_KEY`: Qdrant API Key
|
20 |
- `OPENAI_API_KEY`: OpenAI API Key
|
app.py
CHANGED
@@ -14,7 +14,7 @@ from langchain.chains import RetrievalQA
|
|
14 |
from openai.error import InvalidRequestError
|
15 |
from langchain.chat_models import ChatOpenAI
|
16 |
|
17 |
-
from config import DB_CONFIG,
|
18 |
from models import BaseModel
|
19 |
|
20 |
|
@@ -203,7 +203,7 @@ def run_search(
|
|
203 |
with st.form("my_form"):
|
204 |
st.title("Document Search")
|
205 |
query = st.text_area(label="query")
|
206 |
-
index = st.selectbox(label="index", options=
|
207 |
|
208 |
submit_col1, submit_col2 = st.columns(2)
|
209 |
searched = submit_col1.form_submit_button("Search")
|
|
|
14 |
from openai.error import InvalidRequestError
|
15 |
from langchain.chat_models import ChatOpenAI
|
16 |
|
17 |
+
from config import DB_CONFIG, INDEX_NAMES
|
18 |
from models import BaseModel
|
19 |
|
20 |
|
|
|
203 |
with st.form("my_form"):
|
204 |
st.title("Document Search")
|
205 |
query = st.text_area(label="query")
|
206 |
+
index = st.selectbox(label="index", options=INDEX_NAMES)
|
207 |
|
208 |
submit_col1, submit_col2 = st.columns(2)
|
209 |
searched = submit_col1.form_submit_button("Search")
|
config.py
CHANGED
@@ -18,18 +18,18 @@ def get_local_db_congin():
|
|
18 |
return url, None, collection_name
|
19 |
|
20 |
|
21 |
-
def
|
22 |
keys = [
|
23 |
k for k in [
|
24 |
k.strip().lower()
|
25 |
-
for k in os.environ["
|
26 |
]
|
27 |
if k
|
28 |
]
|
29 |
if not keys:
|
30 |
-
keys = ["
|
31 |
return keys
|
32 |
|
33 |
|
34 |
DB_CONFIG = get_db_config() if SAAS else get_local_db_congin()
|
35 |
-
|
|
|
18 |
return url, None, collection_name
|
19 |
|
20 |
|
21 |
+
def get_index_names():
|
22 |
keys = [
|
23 |
k for k in [
|
24 |
k.strip().lower()
|
25 |
+
for k in os.environ["INDEX_NAMES"].split(",")
|
26 |
]
|
27 |
if k
|
28 |
]
|
29 |
if not keys:
|
30 |
+
keys = ["INDEX_NAMES is empty"]
|
31 |
return keys
|
32 |
|
33 |
|
34 |
DB_CONFIG = get_db_config() if SAAS else get_local_db_congin()
|
35 |
+
INDEX_NAMES = get_index_names()
|