peter2000 commited on
Commit
ef1d02b
1 Parent(s): 0c277f0

Update appStore/keyword_search.py

Browse files
Files changed (1) hide show
  1. appStore/keyword_search.py +1 -7
appStore/keyword_search.py CHANGED
@@ -8,24 +8,19 @@ import scripts.clean as clean
8
  #import needed libraries
9
  import seaborn as sns
10
  from pandas import DataFrame
11
- from sentence_transformers import SentenceTransformer, CrossEncoder, util
12
- # from keybert import KeyBERT
13
- from transformers import pipeline
14
  import matplotlib.pyplot as plt
15
  import numpy as np
16
  import streamlit as st
17
  import pandas as pd
18
- from rank_bm25 import BM25Okapi
19
  from sklearn.feature_extraction import _stop_words
20
  import string
21
  from tqdm.autonotebook import tqdm
22
  import numpy as np
23
 
24
- import tempfile
25
- import sqlite3
26
 
27
  #Haystack Components
28
  @st.cache(hash_funcs={"builtins.SwigPyObject": lambda _: None},allow_output_mutation=True)
 
29
  def start_haystack(temp.name, file):
30
  document_store = InMemoryDocumentStore()
31
  documents = pre.load_document(temp.name, file)
@@ -36,7 +31,6 @@ def start_haystack(temp.name, file):
36
  pipeline = ExtractiveQAPipeline(reader, retriever)
37
  return pipeline
38
 
39
-
40
  def ask_question(question):
41
  prediction = pipeline.run(query=question, params={"Retriever": {"top_k": 10}, "Reader": {"top_k": 5}})
42
  results = []
 
8
  #import needed libraries
9
  import seaborn as sns
10
  from pandas import DataFrame
 
 
 
11
  import matplotlib.pyplot as plt
12
  import numpy as np
13
  import streamlit as st
14
  import pandas as pd
 
15
  from sklearn.feature_extraction import _stop_words
16
  import string
17
  from tqdm.autonotebook import tqdm
18
  import numpy as np
19
 
 
 
20
 
21
  #Haystack Components
22
  @st.cache(hash_funcs={"builtins.SwigPyObject": lambda _: None},allow_output_mutation=True)
23
+
24
  def start_haystack(temp.name, file):
25
  document_store = InMemoryDocumentStore()
26
  documents = pre.load_document(temp.name, file)
 
31
  pipeline = ExtractiveQAPipeline(reader, retriever)
32
  return pipeline
33
 
 
34
  def ask_question(question):
35
  prediction = pipeline.run(query=question, params={"Retriever": {"top_k": 10}, "Reader": {"top_k": 5}})
36
  results = []