Spaces:
Runtime error
Runtime error
samarthagarwal23
commited on
Commit
•
bbce466
1
Parent(s):
ad9a1e9
Update app.py
Browse files
app.py
CHANGED
@@ -71,7 +71,7 @@ def cstr_break(s, color='black'):
|
|
71 |
return "<text style=color:{}><br>{}</text>".format(color, s)
|
72 |
|
73 |
def print_colored(text, start_idx, end_idx, confidence):
|
74 |
-
conf_str = 'Confidence: ' + confidence
|
75 |
a = cstr(' '.join([text[:start_idx], \
|
76 |
cstr_bold(text[start_idx:end_idx], color='blue'), \
|
77 |
text[end_idx:], \
|
@@ -95,7 +95,7 @@ def final_qa_pipeline(file, query):
|
|
95 |
#return (print_colored(fnl_rank[0]['doc'], fnl_rank[0]['start'], fnl_rank[0]['end']), str(np.round(100*fnl_rank[0]["score"],2))+"%"
|
96 |
top1 = print_colored(fnl_rank[0]['doc'], fnl_rank[0]['start'], fnl_rank[0]['end'], str(np.round(100*fnl_rank[0]["score"],1))+"%")
|
97 |
if len(lvl1)>1:
|
98 |
-
top2 = print_colored(fnl_rank[1]['doc'], fnl_rank[1]['start'], fnl_rank[1]['end'], str(np.round(100*fnl_rank[1]["score"],
|
99 |
else:
|
100 |
top2 = "None"
|
101 |
return (top1, top2)
|
|
|
71 |
return "<text style=color:{}><br>{}</text>".format(color, s)
|
72 |
|
73 |
def print_colored(text, start_idx, end_idx, confidence):
|
74 |
+
conf_str = '- Confidence: ' + confidence
|
75 |
a = cstr(' '.join([text[:start_idx], \
|
76 |
cstr_bold(text[start_idx:end_idx], color='blue'), \
|
77 |
text[end_idx:], \
|
|
|
95 |
#return (print_colored(fnl_rank[0]['doc'], fnl_rank[0]['start'], fnl_rank[0]['end']), str(np.round(100*fnl_rank[0]["score"],2))+"%"
|
96 |
top1 = print_colored(fnl_rank[0]['doc'], fnl_rank[0]['start'], fnl_rank[0]['end'], str(np.round(100*fnl_rank[0]["score"],1))+"%")
|
97 |
if len(lvl1)>1:
|
98 |
+
top2 = print_colored(fnl_rank[1]['doc'], fnl_rank[1]['start'], fnl_rank[1]['end'], str(np.round(100*fnl_rank[1]["score"],1))+"%")
|
99 |
else:
|
100 |
top2 = "None"
|
101 |
return (top1, top2)
|