Stefano Fiorucci commited on
Commit
e57fc18
1 Parent(s): f4270c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -21,7 +21,7 @@ from annotated_text import annotation
21
  import shutil
22
 
23
  # FAISS index directory
24
- INDEX_DIR = './index'
25
 
26
 
27
  # the following function is cached to make index and models load only at start
@@ -30,8 +30,9 @@ def start_haystack():
30
  """
31
  load document store, retriever, reader and create pipeline
32
  """
33
- shutil.copy(f'{INDEX_DIR}/faiss_document_store.db','.')
34
  document_store = FAISSDocumentStore(
 
35
  faiss_index_path=f'{INDEX_DIR}/my_faiss_index.faiss',
36
  faiss_config_path=f'{INDEX_DIR}/my_faiss_index.json')
37
  print (f'Index size: {document_store.get_document_count()}')
@@ -148,4 +149,4 @@ Ask any question and see if the system can find the correct answer to your query
148
  #st.write(markdown(f"<a href='{url}'>{title} - <i>{authors}</i></a>"), unsafe_allow_html=True)
149
  #st.write(markdown(f"**Relevance:** {result['score']:.2f}"), unsafe_allow_html=True)
150
 
151
- main()
21
  import shutil
22
 
23
  # FAISS index directory
24
+ INDEX_DIR = './data/index'
25
 
26
 
27
  # the following function is cached to make index and models load only at start
30
  """
31
  load document store, retriever, reader and create pipeline
32
  """
33
+ #shutil.copy(f'{INDEX_DIR}/faiss_document_store.db','.')
34
  document_store = FAISSDocumentStore(
35
+ sql_url=f'sqlite:///{INDEX_DIR}/faiss_document_store.db'
36
  faiss_index_path=f'{INDEX_DIR}/my_faiss_index.faiss',
37
  faiss_config_path=f'{INDEX_DIR}/my_faiss_index.json')
38
  print (f'Index size: {document_store.get_document_count()}')
149
  #st.write(markdown(f"<a href='{url}'>{title} - <i>{authors}</i></a>"), unsafe_allow_html=True)
150
  #st.write(markdown(f"**Relevance:** {result['score']:.2f}"), unsafe_allow_html=True)
151
 
152
+ main()