Update app.py
Browse files
app.py
CHANGED
@@ -161,13 +161,13 @@ def get_prompt(docs, input_query):
|
|
161 |
prompt = base_prompt+"; Context: "+context+"; Question: "+input_query+"; Answer:"
|
162 |
return(prompt)
|
163 |
|
164 |
-
def run_query(
|
165 |
# docs = get_docs(input_text, country)
|
166 |
-
docs = get_docs(
|
167 |
# st.write('Selected country: ', country) # Debugging country
|
168 |
if model_sel == "chatGPT":
|
169 |
# res = pipe.run(query=input_text, documents=docs)
|
170 |
-
res = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=[{"role": "user", "content": get_prompt(docs,
|
171 |
output = res.choices[0].message.content
|
172 |
references = get_refs(docs, output)
|
173 |
# else:
|
@@ -263,13 +263,13 @@ else:
|
|
263 |
|
264 |
|
265 |
if selected_example == "-":
|
266 |
-
|
267 |
else:
|
268 |
-
|
269 |
|
270 |
|
271 |
if st.button('Submit'):
|
272 |
-
run_query(
|
273 |
|
274 |
|
275 |
|
|
|
161 |
prompt = base_prompt+"; Context: "+context+"; Question: "+input_query+"; Answer:"
|
162 |
return(prompt)
|
163 |
|
164 |
+
def run_query(input_text, country, model_sel):
|
165 |
# docs = get_docs(input_text, country)
|
166 |
+
docs = get_docs(input_text, country=country,vulnerability_cat=vulnerability_options)
|
167 |
# st.write('Selected country: ', country) # Debugging country
|
168 |
if model_sel == "chatGPT":
|
169 |
# res = pipe.run(query=input_text, documents=docs)
|
170 |
+
res = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=[{"role": "user", "content": get_prompt(docs, input_text)}])
|
171 |
output = res.choices[0].message.content
|
172 |
references = get_refs(docs, output)
|
173 |
# else:
|
|
|
263 |
|
264 |
|
265 |
if selected_example == "-":
|
266 |
+
text = st.text_area('Enter your question in the text box below using natural language or select an example from above:')
|
267 |
else:
|
268 |
+
text = st.text_area('Enter your question in the text box below using natural language or select an example from above:', value=selected_example)
|
269 |
|
270 |
|
271 |
if st.button('Submit'):
|
272 |
+
run_query(text, country=country, model_sel=model_sel)
|
273 |
|
274 |
|
275 |
|