CarlosMalaga commited on
Commit
2e3f491
1 Parent(s): 37822e8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -150,7 +150,7 @@ def get_retriever_annotations(response):
150
  return dict_of_ents, options
151
  import json
152
  io_map = {}
153
- with open("/home/user/app/model/retriever/document_index/documents.jsonl", "r") as r:
154
  for line in r:
155
  element = json.loads(line)
156
  io_map[element["text"]] = element["metadata"]["type"]
@@ -159,10 +159,10 @@ with open("/home/user/app/model/retriever/document_index/documents.jsonl", "r")
159
  def load_model():
160
 
161
  retriever = GoldenRetriever(
162
- question_encoder="/home/user/app/model/retriever/question_encoder",
163
  document_index=InMemoryDocumentIndex(
164
  documents=DocumentStore.from_file(
165
- "/home/user/app/model/retriever/document_index/documents.jsonl"
166
  ),
167
  metadata_fields=["definition"],
168
  separator=' <def> ',
@@ -173,7 +173,7 @@ def load_model():
173
  )
174
  retriever.index()
175
 
176
- reader = RelikReaderForSpanExtraction("/home/user/app/model/reader",
177
  dataset_kwargs={"use_nme": True})
178
 
179
  relik = Relik(reader=reader, retriever=retriever, window_size="none", top_k=100, task="span", device="cuda", document_index_device="cpu")
 
150
  return dict_of_ents, options
151
  import json
152
  io_map = {}
153
+ with open("/home/user/app/models/retriever/document_index/documents.jsonl", "r") as r:
154
  for line in r:
155
  element = json.loads(line)
156
  io_map[element["text"]] = element["metadata"]["type"]
 
159
  def load_model():
160
 
161
  retriever = GoldenRetriever(
162
+ question_encoder="/home/user/app/models/retriever/question_encoder",
163
  document_index=InMemoryDocumentIndex(
164
  documents=DocumentStore.from_file(
165
+ "/home/user/app/models/retriever/document_index/documents.jsonl"
166
  ),
167
  metadata_fields=["definition"],
168
  separator=' <def> ',
 
173
  )
174
  retriever.index()
175
 
176
+ reader = RelikReaderForSpanExtraction("/home/user/app/models/reader",
177
  dataset_kwargs={"use_nme": True})
178
 
179
  relik = Relik(reader=reader, retriever=retriever, window_size="none", top_k=100, task="span", device="cuda", document_index_device="cpu")