Spaces:
Runtime error
Runtime error
Update appStore/keyword_search.py
Browse files- appStore/keyword_search.py +16 -3
appStore/keyword_search.py
CHANGED
|
@@ -78,10 +78,23 @@ def app():
|
|
| 78 |
value="Which extreme weather is a particular risk?",)
|
| 79 |
|
| 80 |
if st.button("Find them."):
|
| 81 |
-
|
| 82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
-
|
| 85 |
|
| 86 |
with st.spinner("๐ Performing semantic search on"):#+file.name+"..."):
|
| 87 |
try:
|
|
|
|
| 78 |
value="Which extreme weather is a particular risk?",)
|
| 79 |
|
| 80 |
if st.button("Find them."):
|
| 81 |
+
|
| 82 |
+
file = st.session_state['file']
|
| 83 |
+
if file is not None:
|
| 84 |
+
with tempfile.NamedTemporaryFile(mode="wb") as temp:
|
| 85 |
+
bytes_data = file.getvalue()
|
| 86 |
+
temp.write(bytes_data)
|
| 87 |
+
file_name = file.name
|
| 88 |
+
file_path = temp.name
|
| 89 |
+
|
| 90 |
+
st.write("Filename: ", file.name)
|
| 91 |
+
|
| 92 |
+
# load document
|
| 93 |
+
documents = pre.load_document(temp.name,file_name)
|
| 94 |
+
documents_processed = pre.preprocessing(documents)
|
| 95 |
+
pipeline = start_haystack(documents_processed )
|
| 96 |
|
| 97 |
+
|
| 98 |
|
| 99 |
with st.spinner("๐ Performing semantic search on"):#+file.name+"..."):
|
| 100 |
try:
|