Spaces:
Runtime error
Runtime error
added links to each paper results (replacing textbox with markdown)
Browse files
app.py
CHANGED
|
@@ -73,7 +73,7 @@ def get_similar_paper(
|
|
| 73 |
input_sentences = sent_tokenize(abstract_text_input)
|
| 74 |
num_sents = len(input_sentences)
|
| 75 |
|
| 76 |
-
for aa, (tt, ab, ds) in enumerate(zip(titles, abstracts, doc_scores)):
|
| 77 |
# Compute sent-level and phrase-level affinity scores for each papers
|
| 78 |
sent_ids, sent_scores, info, top_pairs_info = get_highlight_info(
|
| 79 |
sent_model,
|
|
@@ -96,7 +96,8 @@ def get_similar_paper(
|
|
| 96 |
'doc_score': '%0.3f'%ds,
|
| 97 |
'source_sentences': input_sentences,
|
| 98 |
'highlight': word_scores,
|
| 99 |
-
'top_pairs': top_pairs_info
|
|
|
|
| 100 |
}
|
| 101 |
|
| 102 |
end = time.time()
|
|
@@ -116,8 +117,9 @@ def get_similar_paper(
|
|
| 116 |
summary_out = []
|
| 117 |
for i in range(top_papers_show):
|
| 118 |
out_tmp = [
|
| 119 |
-
gr.update(value=titles[i], visible=True),
|
| 120 |
-
gr.update(value=
|
|
|
|
| 121 |
]
|
| 122 |
tp = results[display_title[i]]['top_pairs']
|
| 123 |
for j in range(top_num_info_show):
|
|
@@ -173,7 +175,9 @@ def change_paper(selected_papers_radio, info={}):
|
|
| 173 |
abstract = info[selected_papers_radio]['abstract']
|
| 174 |
aff_score = info[selected_papers_radio]['doc_score']
|
| 175 |
highlights = info[selected_papers_radio]['highlight']
|
| 176 |
-
|
|
|
|
|
|
|
| 177 |
|
| 178 |
else:
|
| 179 |
return
|
|
@@ -206,7 +210,7 @@ Below we describe how to use the tool. Also feel free to check out the [video]()
|
|
| 206 |
- Below the list of papers, we highlight relevant parts from the selected paper to different sentences of the submission abstract.
|
| 207 |
- On the left, you will see individual sentences from the submission abstract to select from.
|
| 208 |
- On the right, you will see the abstract of the selected paper, with **highlights** incidating relevant parts to the selected sentence.
|
| 209 |
-
- **<span style="color:black;background-color:#DB7262;">Red highlights</span>**: sentences with high semantic similarity to the selected sentence.
|
| 210 |
- **<span style="color:black;background-color:#65B5E3;">Blue highlights</span>**: phrases included in the selected sentence.
|
| 211 |
- To see relevant parts in a different paper from the reviewer, select the new paper.
|
| 212 |
-------
|
|
@@ -234,12 +238,11 @@ Below we describe how to use the tool. Also feel free to check out the [video]()
|
|
| 234 |
# Paper title, score, and top-ranking sentence pairs -- two sentence pairs per paper, three papers
|
| 235 |
## ONE BLOCK OF INFO FOR A SINGLE PAPER
|
| 236 |
## PAPER1
|
| 237 |
-
# TODO add link to each paper
|
| 238 |
with gr.Row():
|
| 239 |
with gr.Column(scale=3):
|
| 240 |
-
paper_title1 = gr.
|
| 241 |
with gr.Column(scale=1):
|
| 242 |
-
affinity1 = gr.
|
| 243 |
with gr.Row() as rel1_1:
|
| 244 |
with gr.Column(scale=1):
|
| 245 |
sent_pair_score1_1 = gr.Textbox(label='Sentence Relevance', interactive=False, value='', visible=False)
|
|
@@ -267,9 +270,10 @@ Below we describe how to use the tool. Also feel free to check out the [video]()
|
|
| 267 |
## PAPER 2
|
| 268 |
with gr.Row():
|
| 269 |
with gr.Column(scale=3):
|
| 270 |
-
paper_title2 = gr.
|
| 271 |
with gr.Column(scale=1):
|
| 272 |
-
affinity2 = gr.Textbox(label='Affinity', interactive=False, value='', visible=False)
|
|
|
|
| 273 |
with gr.Row() as rel2_1:
|
| 274 |
with gr.Column(scale=1):
|
| 275 |
sent_pair_score2_1 = gr.Textbox(label='Sentence Relevance', interactive=False, value='', visible=False)
|
|
@@ -297,9 +301,10 @@ Below we describe how to use the tool. Also feel free to check out the [video]()
|
|
| 297 |
## PAPER 3
|
| 298 |
with gr.Row():
|
| 299 |
with gr.Column(scale=3):
|
| 300 |
-
paper_title3 = gr.
|
| 301 |
with gr.Column(scale=1):
|
| 302 |
-
affinity3 = gr.Textbox(label='Affinity', interactive=False, value='', visible=False)
|
|
|
|
| 303 |
with gr.Row() as rel3_1:
|
| 304 |
with gr.Column(scale=1):
|
| 305 |
sent_pair_score3_1 = gr.Textbox(label='Sentence Relevance', interactive=False, value='', visible=False)
|
|
@@ -336,7 +341,7 @@ Below we describe how to use the tool. Also feel free to check out the [video]()
|
|
| 336 |
# selected paper information
|
| 337 |
with gr.Row(visible=False) as title_row:
|
| 338 |
with gr.Column(scale=3):
|
| 339 |
-
paper_title = gr.
|
| 340 |
with gr.Column(scale=1):
|
| 341 |
affinity= gr.Textbox(label='Affinity', interactive=False, value='')
|
| 342 |
with gr.Row():
|
|
|
|
| 73 |
input_sentences = sent_tokenize(abstract_text_input)
|
| 74 |
num_sents = len(input_sentences)
|
| 75 |
|
| 76 |
+
for aa, (tt, ab, ds, url) in enumerate(zip(titles, abstracts, doc_scores, paper_urls)):
|
| 77 |
# Compute sent-level and phrase-level affinity scores for each papers
|
| 78 |
sent_ids, sent_scores, info, top_pairs_info = get_highlight_info(
|
| 79 |
sent_model,
|
|
|
|
| 96 |
'doc_score': '%0.3f'%ds,
|
| 97 |
'source_sentences': input_sentences,
|
| 98 |
'highlight': word_scores,
|
| 99 |
+
'top_pairs': top_pairs_info,
|
| 100 |
+
'url': url
|
| 101 |
}
|
| 102 |
|
| 103 |
end = time.time()
|
|
|
|
| 117 |
summary_out = []
|
| 118 |
for i in range(top_papers_show):
|
| 119 |
out_tmp = [
|
| 120 |
+
#gr.update(value=titles[i], visible=True),
|
| 121 |
+
gr.update(value="#### [%s](%s)"%(titles[i], paper_urls[i]), visible=True),
|
| 122 |
+
gr.update(value='#### Affinity: %0.3f'%doc_scores[i], visible=True) # document affinity
|
| 123 |
]
|
| 124 |
tp = results[display_title[i]]['top_pairs']
|
| 125 |
for j in range(top_num_info_show):
|
|
|
|
| 175 |
abstract = info[selected_papers_radio]['abstract']
|
| 176 |
aff_score = info[selected_papers_radio]['doc_score']
|
| 177 |
highlights = info[selected_papers_radio]['highlight']
|
| 178 |
+
url = info[selected_papers_radio]['url']
|
| 179 |
+
title_out = '#### [%s](%s)'%(title, url) # output in format of markdown
|
| 180 |
+
return title_out, abstract, aff_score, highlights['0']
|
| 181 |
|
| 182 |
else:
|
| 183 |
return
|
|
|
|
| 210 |
- Below the list of papers, we highlight relevant parts from the selected paper to different sentences of the submission abstract.
|
| 211 |
- On the left, you will see individual sentences from the submission abstract to select from.
|
| 212 |
- On the right, you will see the abstract of the selected paper, with **highlights** incidating relevant parts to the selected sentence.
|
| 213 |
+
- **<span style="color:black;background-color:#DB7262;">Red highlights</span>**: sentences with high semantic similarity to the selected sentence. The darker the color, the higher the similarity.
|
| 214 |
- **<span style="color:black;background-color:#65B5E3;">Blue highlights</span>**: phrases included in the selected sentence.
|
| 215 |
- To see relevant parts in a different paper from the reviewer, select the new paper.
|
| 216 |
-------
|
|
|
|
| 238 |
# Paper title, score, and top-ranking sentence pairs -- two sentence pairs per paper, three papers
|
| 239 |
## ONE BLOCK OF INFO FOR A SINGLE PAPER
|
| 240 |
## PAPER1
|
|
|
|
| 241 |
with gr.Row():
|
| 242 |
with gr.Column(scale=3):
|
| 243 |
+
paper_title1 = gr.Markdown(value='', visible=False)
|
| 244 |
with gr.Column(scale=1):
|
| 245 |
+
affinity1 = gr.Markdown(value='', visible=False)
|
| 246 |
with gr.Row() as rel1_1:
|
| 247 |
with gr.Column(scale=1):
|
| 248 |
sent_pair_score1_1 = gr.Textbox(label='Sentence Relevance', interactive=False, value='', visible=False)
|
|
|
|
| 270 |
## PAPER 2
|
| 271 |
with gr.Row():
|
| 272 |
with gr.Column(scale=3):
|
| 273 |
+
paper_title2 = gr.Markdown(value='', visible=False)
|
| 274 |
with gr.Column(scale=1):
|
| 275 |
+
#affinity2 = gr.Textbox(label='Affinity', interactive=False, value='', visible=False)
|
| 276 |
+
affinity2 = gr.Markdown(value='', visible=False)
|
| 277 |
with gr.Row() as rel2_1:
|
| 278 |
with gr.Column(scale=1):
|
| 279 |
sent_pair_score2_1 = gr.Textbox(label='Sentence Relevance', interactive=False, value='', visible=False)
|
|
|
|
| 301 |
## PAPER 3
|
| 302 |
with gr.Row():
|
| 303 |
with gr.Column(scale=3):
|
| 304 |
+
paper_title3 = gr.Markdown(value='', visible=False)
|
| 305 |
with gr.Column(scale=1):
|
| 306 |
+
# affinity3 = gr.Textbox(label='Affinity', interactive=False, value='', visible=False)
|
| 307 |
+
affinity3 = gr.Markdown(value='', visible=False)
|
| 308 |
with gr.Row() as rel3_1:
|
| 309 |
with gr.Column(scale=1):
|
| 310 |
sent_pair_score3_1 = gr.Textbox(label='Sentence Relevance', interactive=False, value='', visible=False)
|
|
|
|
| 341 |
# selected paper information
|
| 342 |
with gr.Row(visible=False) as title_row:
|
| 343 |
with gr.Column(scale=3):
|
| 344 |
+
paper_title = gr.Markdown(value='')
|
| 345 |
with gr.Column(scale=1):
|
| 346 |
affinity= gr.Textbox(label='Affinity', interactive=False, value='')
|
| 347 |
with gr.Row():
|