ToluClassics commited on
Commit
9a6b218
Β·
1 Parent(s): 16a6bc6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -10
app.py CHANGED
@@ -27,14 +27,6 @@ with open(os.path.join(os.getcwd(),".streamlit/config.toml"), "w") as file:
27
  Searcher = Union[FaissSearcher, LuceneSearcher]
28
  LANG_MAPPING = {'Arabic':'ar'}
29
 
30
- def download_indices(language):
31
- if not os.path.exists('indices'):
32
- os.mkdir("indices")
33
-
34
- if not os.path.exists(f'indices/lucene-index.miracl-v1.0-{language}.20221004.2b2856'):
35
- util.download_and_unpack_index(f"https://rgw.cs.uwaterloo.ca/JIMMYLIN-bucket0/pyserini-indexes/lucene-index.miracl-v1.0-{language}.20221004.2b2856.tar.gz", "indices")
36
-
37
-
38
 
39
  st.sidebar.markdown(
40
  """
@@ -80,7 +72,7 @@ max_results = st.sidebar.slider(
80
 
81
 
82
  def _load_sparse_searcher(language: str, k1: Optional[float]=None, b: Optional[float]=None) -> (Searcher):
83
- searcher = LuceneSearcher(f'indices/lucene-index.miracl-v1.0-{language}.20221004.2b2856')
84
  searcher.set_language(language)
85
  if k1 is not None and b is not None:
86
  searcher.set_bm25(k1, b)
@@ -130,7 +122,6 @@ def process_results(hits: dict, highlight_terms: list) -> str:
130
 
131
 
132
  if st.sidebar.button("Search"):
133
- download_indices(LANG_MAPPING[language])
134
  hits, search_time = search(query, language, max_results)
135
  html_results = process_results(hits, [])
136
  rendered_results = f"""
 
27
  Searcher = Union[FaissSearcher, LuceneSearcher]
28
  LANG_MAPPING = {'Arabic':'ar'}
29
 
 
 
 
 
 
 
 
 
30
 
31
  st.sidebar.markdown(
32
  """
 
72
 
73
 
74
  def _load_sparse_searcher(language: str, k1: Optional[float]=None, b: Optional[float]=None) -> (Searcher):
75
+ searcher = LuceneSearcher(f'lucene-index.miracl-v1.0-{language}.20221004.2b2856')
76
  searcher.set_language(language)
77
  if k1 is not None and b is not None:
78
  searcher.set_bm25(k1, b)
 
122
 
123
 
124
  if st.sidebar.button("Search"):
 
125
  hits, search_time = search(query, language, max_results)
126
  html_results = process_results(hits, [])
127
  rendered_results = f"""