Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,7 @@ st.session_state["api_key_configured"] = True
|
|
22 |
search_bar, button = st.columns(2)
|
23 |
# Search bar
|
24 |
with search_bar:
|
25 |
-
|
26 |
|
27 |
with button:
|
28 |
st.write("")
|
@@ -31,19 +31,19 @@ with button:
|
|
31 |
|
32 |
if st.session_state.get("api_key_configured"):
|
33 |
run_query = (
|
34 |
-
run_pressed
|
35 |
)
|
36 |
|
37 |
# Get results for query
|
38 |
-
if run_query and
|
39 |
reset_results()
|
40 |
-
st.session_state.
|
41 |
with st.spinner("🔎"):
|
42 |
try:
|
43 |
-
st.session_state.result = query(
|
44 |
except JSONDecodeError as je:
|
45 |
st.error(
|
46 |
-
"
|
47 |
)
|
48 |
except Exception as e:
|
49 |
logging.exception(e)
|
|
|
22 |
search_bar, button = st.columns(2)
|
23 |
# Search bar
|
24 |
with search_bar:
|
25 |
+
prompt = st.text_input("Your question", on_change=reset_results)
|
26 |
|
27 |
with button:
|
28 |
st.write("")
|
|
|
31 |
|
32 |
if st.session_state.get("api_key_configured"):
|
33 |
run_query = (
|
34 |
+
run_pressed
|
35 |
)
|
36 |
|
37 |
# Get results for query
|
38 |
+
if run_query and prompt:
|
39 |
reset_results()
|
40 |
+
st.session_state.prompt = prompt
|
41 |
with st.spinner("🔎"):
|
42 |
try:
|
43 |
+
st.session_state.result = query(prompt, pipeline)
|
44 |
except JSONDecodeError as je:
|
45 |
st.error(
|
46 |
+
"🛑 Something went wrong! Database failure."
|
47 |
)
|
48 |
except Exception as e:
|
49 |
logging.exception(e)
|