Spaces:
Runtime error
Runtime error
Commit
·
f3c6f29
1
Parent(s):
b97ca50
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
from sentence_transformers import CrossEncoder
|
4 |
-
import numpy as np
|
5 |
|
6 |
passage_retreival_model = CrossEncoder('cross-encoder/ms-marco-MiniLM-L-6-v2')
|
7 |
qa_model = pipeline("question-answering",'a-ware/bart-squadv2')
|
@@ -12,8 +11,7 @@ def fetch_answers(question, clincal_note ):
|
|
12 |
|
13 |
scores = passage_retreival_model.predict(query_paragraph_list)
|
14 |
top_5_indices = scores.argsort()[-5:]
|
15 |
-
|
16 |
-
top_5_query_paragraph_list = query_paragraph_list[top_5_indices]
|
17 |
|
18 |
top_5_query_paragraph_answer_list = []
|
19 |
for query, passage in top_5_query_paragraph_list:
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
from sentence_transformers import CrossEncoder
|
|
|
4 |
|
5 |
passage_retreival_model = CrossEncoder('cross-encoder/ms-marco-MiniLM-L-6-v2')
|
6 |
qa_model = pipeline("question-answering",'a-ware/bart-squadv2')
|
|
|
11 |
|
12 |
scores = passage_retreival_model.predict(query_paragraph_list)
|
13 |
top_5_indices = scores.argsort()[-5:]
|
14 |
+
top_5_query_paragraph_list = [query_paragraph_list[i] for i in top_5_indices ]
|
|
|
15 |
|
16 |
top_5_query_paragraph_answer_list = []
|
17 |
for query, passage in top_5_query_paragraph_list:
|