Spaces:
Runtime error
Runtime error
ekaterinatao
commited on
Commit
•
fd8a34b
1
Parent(s):
9c741c7
Create get_answer_local.py
Browse files- utils/get_answer_local.py +17 -0
utils/get_answer_local.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from utils.func import (get_ranked_docs,
|
2 |
+
load_dataset, load_cls_base,
|
3 |
+
load_bi_enc_model, load_cross_enc_model)
|
4 |
+
|
5 |
+
|
6 |
+
def get_answer(user_input):
|
7 |
+
dataset = load_dataset()
|
8 |
+
cls_base = load_cls_base()
|
9 |
+
bi_enc_model = load_bi_enc_model()
|
10 |
+
cross_enc_model = load_cross_enc_model()
|
11 |
+
|
12 |
+
answer = get_ranked_docs(
|
13 |
+
query=user_input, vec_query_base=cls_base, data=dataset,
|
14 |
+
bi_model=bi_enc_model[0], bi_tok=bi_enc_model[1],
|
15 |
+
cross_model=cross_enc_model[0], cross_tok=cross_enc_model[1]
|
16 |
+
)
|
17 |
+
return answer
|