Spaces:
Runtime error
Runtime error
Jorge Henao
commited on
Commit
·
c27d381
1
Parent(s):
8087e34
cluster fix
Browse files- __pycache__/config.cpython-38.pyc +0 -0
- __pycache__/document_quieries.cpython-38.pyc +0 -0
- app.py +1 -1
- config.py +3 -3
- document_quieries.py +3 -3
__pycache__/config.cpython-38.pyc
CHANGED
Binary files a/__pycache__/config.cpython-38.pyc and b/__pycache__/config.cpython-38.pyc differ
|
|
__pycache__/document_quieries.cpython-38.pyc
CHANGED
Binary files a/__pycache__/document_quieries.cpython-38.pyc and b/__pycache__/document_quieries.cpython-38.pyc differ
|
|
app.py
CHANGED
@@ -21,7 +21,7 @@ def fake_search(question, retriever_top_k, reader_top_k):
|
|
21 |
return result
|
22 |
|
23 |
def search(question, retriever_top_k, reader_top_k):
|
24 |
-
query_result = extractive_query.search_by_query(query = question, retriever_top_k = retriever_top_k, reader_top_k = reader_top_k
|
25 |
result = []
|
26 |
for i in range(0, len(query_result)):
|
27 |
item = query_result[i]
|
|
|
21 |
return result
|
22 |
|
23 |
def search(question, retriever_top_k, reader_top_k):
|
24 |
+
query_result = extractive_query.search_by_query(query = question, retriever_top_k = retriever_top_k, reader_top_k = reader_top_k)
|
25 |
result = []
|
26 |
for i in range(0, len(query_result)):
|
27 |
item = query_result[i]
|
config.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
class Config():
|
2 |
-
es_host = "
|
3 |
-
es_user = "
|
4 |
-
es_password = "
|
5 |
proposals_index = "informecomisionverdad"
|
6 |
reader_model_name_or_path = "deepset/xlm-roberta-base-squad2-distilled"
|
7 |
#reader_model_name_or_path = "deepset/xlm-roberta-base-squad2"
|
|
|
1 |
class Config():
|
2 |
+
es_host = "saimon-askwdemocracy.es.us-central1.gcp.cloud.es.io"
|
3 |
+
es_user = "elastic"
|
4 |
+
es_password = "NY5Gqg83peXwagrfolBFUhhy"
|
5 |
proposals_index = "informecomisionverdad"
|
6 |
reader_model_name_or_path = "deepset/xlm-roberta-base-squad2-distilled"
|
7 |
#reader_model_name_or_path = "deepset/xlm-roberta-base-squad2"
|
document_quieries.py
CHANGED
@@ -34,8 +34,8 @@ class ExtractiveProposalQueries(DocumentQueries):
|
|
34 |
|
35 |
def search_by_query(self, query : str, retriever_top_k: int, reader_top_k: int, es_index: str = None) :
|
36 |
self.log.write_log(query, "hfspace-informecomision")
|
37 |
-
if es_index is not None:
|
38 |
-
self._initialize_pipeline(self.es_host, es_index, self.es_user, self.es_password)
|
39 |
params = {"Retriever": {"top_k": retriever_top_k}, "Reader": {"top_k": reader_top_k}}
|
40 |
prediction = self.pipe.run( query = query, params = params)
|
41 |
return prediction["answers"]
|
@@ -44,7 +44,7 @@ class Log():
|
|
44 |
|
45 |
def __init__(self, es_host: str, es_index: str, es_user, es_password) -> None:
|
46 |
self.elastic_endpoint = f"https://{es_host}:443/{es_index}/_doc"
|
47 |
-
self.credentials = b64encode(b"
|
48 |
self.auth_header = { 'Authorization' : 'Basic %s' % self.credentials }
|
49 |
|
50 |
def write_log(self, message: str, source: str) -> None:
|
|
|
34 |
|
35 |
def search_by_query(self, query : str, retriever_top_k: int, reader_top_k: int, es_index: str = None) :
|
36 |
self.log.write_log(query, "hfspace-informecomision")
|
37 |
+
#if es_index is not None:
|
38 |
+
#self._initialize_pipeline(self.es_host, es_index, self.es_user, self.es_password)
|
39 |
params = {"Retriever": {"top_k": retriever_top_k}, "Reader": {"top_k": reader_top_k}}
|
40 |
prediction = self.pipe.run( query = query, params = params)
|
41 |
return prediction["answers"]
|
|
|
44 |
|
45 |
def __init__(self, es_host: str, es_index: str, es_user, es_password) -> None:
|
46 |
self.elastic_endpoint = f"https://{es_host}:443/{es_index}/_doc"
|
47 |
+
self.credentials = b64encode(b"3pvrzh9tl:4yl4vk9ijr").decode("ascii")
|
48 |
self.auth_header = { 'Authorization' : 'Basic %s' % self.credentials }
|
49 |
|
50 |
def write_log(self, message: str, source: str) -> None:
|