peter2000 commited on
Commit
bca1994
β€’
1 Parent(s): b6d5ef6

Update appStore/keyword_search.py

Browse files
Files changed (1) hide show
  1. 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
- document = st.session_state['document']
82
- pipeline = start_haystack(document)
 
 
 
 
 
 
 
 
 
 
 
 
 
83
 
84
- if document is not None:
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: