daneshjoy commited on
Commit
f970248
·
1 Parent(s): eab155e

fixed import error and disabled gpu usage

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -1,6 +1,14 @@
1
  import os
2
 
3
  import streamlit as st
 
 
 
 
 
 
 
 
4
 
5
  from lfqa import prepare, answer
6
 
@@ -124,10 +132,6 @@ def main(pipe):
124
 
125
  # %% ------------------------------------------- Creating Doc store
126
  # if not os.path.exists(sql_file) or not os.path.exists(faiss_file):
127
- from haystack.document_stores import FAISSDocumentStore
128
- from haystack.nodes import DensePassageRetriever
129
- from haystack.utils import convert_files_to_docs, clean_wiki_text
130
-
131
 
132
  module_dir = os.path.dirname(os.path.abspath(__file__))
133
  os.chdir(module_dir)
@@ -163,7 +167,7 @@ retriever = DensePassageRetriever(
163
  document_store=document_store,
164
  query_embedding_model="vblagoje/dpr-question_encoder-single-lfqa-wiki",
165
  passage_embedding_model="vblagoje/dpr-ctx_encoder-single-lfqa-wiki",
166
- use_gpu=True
167
  )
168
 
169
  # %% Create Embeddings and save results
 
1
  import os
2
 
3
  import streamlit as st
4
+ from haystack.document_stores import FAISSDocumentStore
5
+ from haystack.utils import convert_files_to_docs, fetch_archive_from_http, clean_wiki_text
6
+ from haystack.nodes import DensePassageRetriever
7
+ from haystack.utils import print_documents, print_answers
8
+ from haystack.pipelines import DocumentSearchPipeline
9
+ from haystack.nodes import Seq2SeqGenerator
10
+ from haystack.pipelines import GenerativeQAPipeline
11
+ from haystack.utils import convert_files_to_docs, clean_wiki_text
12
 
13
  from lfqa import prepare, answer
14
 
 
132
 
133
  # %% ------------------------------------------- Creating Doc store
134
  # if not os.path.exists(sql_file) or not os.path.exists(faiss_file):
 
 
 
 
135
 
136
  module_dir = os.path.dirname(os.path.abspath(__file__))
137
  os.chdir(module_dir)
 
167
  document_store=document_store,
168
  query_embedding_model="vblagoje/dpr-question_encoder-single-lfqa-wiki",
169
  passage_embedding_model="vblagoje/dpr-ctx_encoder-single-lfqa-wiki",
170
+ use_gpu=False
171
  )
172
 
173
  # %% Create Embeddings and save results