Spaces:
Sleeping
Sleeping
update app.py
Browse files
app.py
CHANGED
|
@@ -15,7 +15,7 @@ sidebar()
|
|
| 15 |
|
| 16 |
st.write("# π€ What have they been posting about lately on Mastodon?")
|
| 17 |
|
| 18 |
-
if st.session_state.get("
|
| 19 |
pipeline = start_haystack(st.session_state.get("HUGGING_FACE_TOKEN"))
|
| 20 |
st.session_state["api_key_configured"] = True
|
| 21 |
search_bar, button = st.columns(2)
|
|
@@ -33,16 +33,16 @@ else:
|
|
| 33 |
|
| 34 |
if st.session_state.get("api_key_configured"):
|
| 35 |
run_query = (
|
| 36 |
-
run_pressed or
|
| 37 |
)
|
| 38 |
|
| 39 |
# Get results for query
|
| 40 |
-
if run_query and
|
| 41 |
reset_results()
|
| 42 |
-
st.session_state.
|
| 43 |
with st.spinner("π"):
|
| 44 |
try:
|
| 45 |
-
st.session_state.result = query(
|
| 46 |
except JSONDecodeError as je:
|
| 47 |
st.error(
|
| 48 |
"π An error occurred reading the results. Is the document store working?"
|
|
|
|
| 15 |
|
| 16 |
st.write("# π€ What have they been posting about lately on Mastodon?")
|
| 17 |
|
| 18 |
+
if st.session_state.get("HUGGING_FACE_TOKEN"):
|
| 19 |
pipeline = start_haystack(st.session_state.get("HUGGING_FACE_TOKEN"))
|
| 20 |
st.session_state["api_key_configured"] = True
|
| 21 |
search_bar, button = st.columns(2)
|
|
|
|
| 33 |
|
| 34 |
if st.session_state.get("api_key_configured"):
|
| 35 |
run_query = (
|
| 36 |
+
run_pressed or question != st.session_state.question
|
| 37 |
)
|
| 38 |
|
| 39 |
# Get results for query
|
| 40 |
+
if run_query and question:
|
| 41 |
reset_results()
|
| 42 |
+
st.session_state.question = question
|
| 43 |
with st.spinner("π"):
|
| 44 |
try:
|
| 45 |
+
st.session_state.result = query(question, pipeline)
|
| 46 |
except JSONDecodeError as je:
|
| 47 |
st.error(
|
| 48 |
"π An error occurred reading the results. Is the document store working?"
|