Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -155,6 +155,7 @@ countries = [
|
|
155 |
"Germany",
|
156 |
]
|
157 |
|
|
|
158 |
@st.cache_data # only going to get once
|
159 |
def get_llm(temp = st.session_state['temperature'], tokens = st.session_state['max_new_tokens']):
|
160 |
# This is an inference endpoint API from huggingface, the model is not run locally, it is run on huggingface
|
@@ -179,6 +180,23 @@ def get_embeddings():
|
|
179 |
|
180 |
hf_embeddings = get_embeddings()
|
181 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
# Chromadb vector stores have already been pre-created for the countries above for each of the different chunk sizes and overlaps,
|
183 |
# to save time when experimenting as the embeddings take a long time to generate.
|
184 |
# The existing stores will be pulled using !wget above when app starts. When using the existing vector stores,
|
|
|
155 |
"Germany",
|
156 |
]
|
157 |
|
158 |
+
|
159 |
@st.cache_data # only going to get once
|
160 |
def get_llm(temp = st.session_state['temperature'], tokens = st.session_state['max_new_tokens']):
|
161 |
# This is an inference endpoint API from huggingface, the model is not run locally, it is run on huggingface
|
|
|
180 |
|
181 |
hf_embeddings = get_embeddings()
|
182 |
|
183 |
+
if not os.path.exists("bm25.zip"):
|
184 |
+
with st.spinner(f'Downloading bm25 retriever for all chunk sizes and overlaps'):
|
185 |
+
os.system("gdown https://drive.google.com/uc?id=1q-hNnyyBA8tKyF3vR69nkwCk9kJj7WHi")
|
186 |
+
|
187 |
+
if not os.path.exists("chromadb.zip"):
|
188 |
+
with st.spinner(f'Downloading chromadb retrievers for all chunk sizes and overlaps'):
|
189 |
+
os.system("gdown https://drive.google.com/uc?id=1zad6tgYm2o5M9E2dTLQqmm6GoI8kxNC3")
|
190 |
+
|
191 |
+
if not os.path.exists("bm25/"):
|
192 |
+
with st.spinner(f'Unzipping bm25 retriever for all chunk sizes and overlaps'):
|
193 |
+
os.system("unzip bm25.zip")
|
194 |
+
|
195 |
+
if not os.path.exists("chromadb/"):
|
196 |
+
with st.spinner(f'Unzipping chromadb retrievers for all chunk sizes and overlaps'):
|
197 |
+
os.system("unzip chromadb.zip")
|
198 |
+
|
199 |
+
|
200 |
# Chromadb vector stores have already been pre-created for the countries above for each of the different chunk sizes and overlaps,
|
201 |
# to save time when experimenting as the embeddings take a long time to generate.
|
202 |
# The existing stores will be pulled using !wget above when app starts. When using the existing vector stores,
|