Update app.py
Browse files
app.py
CHANGED
@@ -25,17 +25,7 @@ openai.api_key = os.environ["OPENAI_API_KEY"]
|
|
25 |
# Get openai API key
|
26 |
pinecone_key = os.environ["PINECONE_API_KEY"]
|
27 |
|
28 |
-
#
|
29 |
-
# retriever = EmbeddingRetriever(
|
30 |
-
# document_store=FAISSDocumentStore.load(
|
31 |
-
# index_path="./cpv_full_southern_africa_kenya.faiss",
|
32 |
-
# config_path="./cpv_full_southern_africa_kenya.json",
|
33 |
-
# ),
|
34 |
-
# embedding_model="sentence-transformers/multi-qa-mpnet-base-dot-v1",
|
35 |
-
# model_format="sentence_transformers",
|
36 |
-
# progress_bar=False,
|
37 |
-
# )
|
38 |
-
|
39 |
|
40 |
@st.cache_resource
|
41 |
def get_document_store():
|
@@ -66,15 +56,19 @@ ALWAYS include references for information used from documents at the end of each
|
|
66 |
Do not include page numbers in the references. \
|
67 |
If no relevant information to answer the question is present in the documents, just say you don't have enough information to answer."
|
68 |
|
|
|
69 |
# Create a list of options for the dropdown
|
70 |
model_options = ['chatGPT','Llama2']
|
71 |
|
|
|
72 |
# Create a list of options for the dropdown
|
73 |
country_options = ['All Countries','Angola','Botswana','Lesotho','Kenya','Malawi','Mozambique','Namibia','Rwanda','South Africa','Zambia','Zimbabwe']
|
74 |
|
|
|
75 |
# Create a list of options for the dropdown
|
76 |
vulnerability_options = ['All Categories','Agricultural communities', 'Children', 'Coastal communities', 'Ethnic, racial or other minorities', 'Fishery communities', 'Informal sector workers', 'Members of indigenous and local communities', 'Migrants and displaced persons', 'Older persons', 'Persons living in poverty', 'Persons with disabilities', 'Persons with pre-existing health conditions', 'Residents of drought-prone regions', 'Rural populations', 'Sexual minorities (LGBTQI+)', 'Urban populations', 'Women and other genders','Other']
|
77 |
|
|
|
78 |
# List of examples
|
79 |
examples = [
|
80 |
"-",
|
@@ -168,12 +162,12 @@ def run_query(input_text, country, model_sel):
|
|
168 |
st.markdown(references, unsafe_allow_html=True)
|
169 |
|
170 |
|
171 |
-
|
172 |
|
173 |
with st.sidebar:
|
174 |
# Dropdown selectbox
|
175 |
country = st.sidebar.multiselect('Filter by country:', country_options)
|
176 |
-
vulnerabilities_cat = st.sidebar.
|
177 |
with st.expander("ℹ️ - About filters", expanded=False):
|
178 |
st.markdown(
|
179 |
"""
|
@@ -208,10 +202,6 @@ with st.expander("ℹ️ - About this app", expanded=False):
|
|
208 |
st.write(vulnerabilities_cat)
|
209 |
|
210 |
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
# Dropdown selectbox: model
|
216 |
# model_sel = st.selectbox('Select an LLM:', model_options)
|
217 |
model_sel = "chatGPT"
|
|
|
25 |
# Get openai API key
|
26 |
pinecone_key = os.environ["PINECONE_API_KEY"]
|
27 |
|
28 |
+
#___________________________________________________________________________________________________________
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
@st.cache_resource
|
31 |
def get_document_store():
|
|
|
56 |
Do not include page numbers in the references. \
|
57 |
If no relevant information to answer the question is present in the documents, just say you don't have enough information to answer."
|
58 |
|
59 |
+
@st.cache.data
|
60 |
# Create a list of options for the dropdown
|
61 |
model_options = ['chatGPT','Llama2']
|
62 |
|
63 |
+
@st.cache.data
|
64 |
# Create a list of options for the dropdown
|
65 |
country_options = ['All Countries','Angola','Botswana','Lesotho','Kenya','Malawi','Mozambique','Namibia','Rwanda','South Africa','Zambia','Zimbabwe']
|
66 |
|
67 |
+
@st.cache.data
|
68 |
# Create a list of options for the dropdown
|
69 |
vulnerability_options = ['All Categories','Agricultural communities', 'Children', 'Coastal communities', 'Ethnic, racial or other minorities', 'Fishery communities', 'Informal sector workers', 'Members of indigenous and local communities', 'Migrants and displaced persons', 'Older persons', 'Persons living in poverty', 'Persons with disabilities', 'Persons with pre-existing health conditions', 'Residents of drought-prone regions', 'Rural populations', 'Sexual minorities (LGBTQI+)', 'Urban populations', 'Women and other genders','Other']
|
70 |
|
71 |
+
@st.cache.data
|
72 |
# List of examples
|
73 |
examples = [
|
74 |
"-",
|
|
|
162 |
st.markdown(references, unsafe_allow_html=True)
|
163 |
|
164 |
|
165 |
+
#___________________________________________________________________________________________________________
|
166 |
|
167 |
with st.sidebar:
|
168 |
# Dropdown selectbox
|
169 |
country = st.sidebar.multiselect('Filter by country:', country_options)
|
170 |
+
vulnerabilities_cat = st.sidebar.selectbox('Filter by vulnerabilities category:', vulnerability_options)
|
171 |
with st.expander("ℹ️ - About filters", expanded=False):
|
172 |
st.markdown(
|
173 |
"""
|
|
|
202 |
st.write(vulnerabilities_cat)
|
203 |
|
204 |
|
|
|
|
|
|
|
|
|
205 |
# Dropdown selectbox: model
|
206 |
# model_sel = st.selectbox('Select an LLM:', model_options)
|
207 |
model_sel = "chatGPT"
|