Spaces:
Runtime error
Runtime error
Update appStore/keyword_search.py
Browse files
appStore/keyword_search.py
CHANGED
|
@@ -21,10 +21,8 @@ import numpy as np
|
|
| 21 |
#Haystack Components
|
| 22 |
@st.cache(hash_funcs={"builtins.SwigPyObject": lambda _: None},allow_output_mutation=True)
|
| 23 |
|
| 24 |
-
def start_haystack(
|
| 25 |
document_store = InMemoryDocumentStore()
|
| 26 |
-
documents = pre.load_document(temp.name, file)
|
| 27 |
-
documents_processed = pre.preprocessing(documents)
|
| 28 |
document_store.write_documents(documents_processed)
|
| 29 |
retriever = TfidfRetriever(document_store=document_store)
|
| 30 |
reader = FARMReader(model_name_or_path="deepset/roberta-base-squad2-distilled", use_gpu=True)
|
|
@@ -83,7 +81,9 @@ def app():
|
|
| 83 |
st.write("Filename: ", file.name)
|
| 84 |
|
| 85 |
# load document
|
| 86 |
-
|
|
|
|
|
|
|
| 87 |
#docs = pre.load_document(temp.name, file)
|
| 88 |
|
| 89 |
# preprocess document
|
|
|
|
| 21 |
#Haystack Components
|
| 22 |
@st.cache(hash_funcs={"builtins.SwigPyObject": lambda _: None},allow_output_mutation=True)
|
| 23 |
|
| 24 |
+
def start_haystack(documents_processed):
|
| 25 |
document_store = InMemoryDocumentStore()
|
|
|
|
|
|
|
| 26 |
document_store.write_documents(documents_processed)
|
| 27 |
retriever = TfidfRetriever(document_store=document_store)
|
| 28 |
reader = FARMReader(model_name_or_path="deepset/roberta-base-squad2-distilled", use_gpu=True)
|
|
|
|
| 81 |
st.write("Filename: ", file.name)
|
| 82 |
|
| 83 |
# load document
|
| 84 |
+
documents = pre.load_document(temp.name, file)
|
| 85 |
+
documents_processed = pre.preprocessing(documents)
|
| 86 |
+
pipeline = start_haystack(documents_processed)
|
| 87 |
#docs = pre.load_document(temp.name, file)
|
| 88 |
|
| 89 |
# preprocess document
|