jskim commited on
Commit
961f39c
1 Parent(s): 648fab4

added more details page. modified the explore more section design.

Browse files
Files changed (3) hide show
  1. app.py +69 -64
  2. details.html +25 -0
  3. score.py +2 -1
app.py CHANGED
@@ -113,8 +113,8 @@ def get_similar_paper(
113
 
114
  # set up elements to show
115
  out = [
116
- gr.update(choices=display_title, interactive=True, visible=False), # set of papers (radio)
117
- gr.update(choices=input_sentences, interactive=True, visible=False) # submission sentences
118
  ]
119
 
120
  # set up elements to visualize upfront
@@ -178,6 +178,12 @@ def get_similar_paper(
178
  # progress status
179
  out += [gr.update(value='Done (in %0.1f seconds)'%(retrieval_time+highlight_time), visible=True)]
180
 
 
 
 
 
 
 
181
  # add the search results to pass on to the Gradio State varaible
182
  out += [results]
183
 
@@ -186,13 +192,12 @@ def get_similar_paper(
186
  def show_more(info):
187
  # show the interactive part of the app
188
  return (
189
- gr.update(value="""
190
- ### Click on different papers by %s below (sorted by their affinity scores) to see other relevant parts!
191
- """%info['name'], visible=True), # description
192
  gr.update(visible=True), # set of papers
193
  gr.update(visible=True), # submission sentences
194
  gr.update(visible=True), # title row
195
- gr.update(visible=True), # abstract row
 
196
  )
197
 
198
  def show_status():
@@ -223,8 +228,8 @@ def change_paper(selected_papers_radio, info={}):
223
  aff_score = info[selected_papers_radio]['doc_score']
224
  highlights = info[selected_papers_radio]['highlight']
225
  url = info[selected_papers_radio]['url']
226
- title_out = """<a href="%s" target="_blank"><h4>%s</h4></a>"""%(url, title)
227
- aff_score_out = '#### Affinity Score: %s'%aff_score
228
  return title_out, abstract, aff_score_out, highlights['0']
229
 
230
  else:
@@ -235,24 +240,26 @@ with gr.Blocks(css='style.css') as demo:
235
 
236
  # Text description about the app and disclaimer
237
  ### TEXT Description
238
- # TODO add instruction video link
239
- gr.Markdown(
240
- """
241
- # R2P2: Matching Reviewers to Papers in Peer Review
242
 
243
- #### Who is R2P2 for?
 
 
 
 
244
  It is for meta-reviewers, area chairs, program chairs, or anyone who oversees the submission-reviewer matching process in peer review for acadmeic conferences, journals, and grants.
245
 
246
  #### How does it help?
247
- A typical meta-reviewer workflow lacks supportive information on what makes the pre-selected candidate reviewers good fit for the submission. Only the **affinity scores** between the reviewer and the paper are provided, with no additional detail.
248
 
249
- R2P2 provide more information about each reviewer. It searches for the most relevant papers among the reviewer's previous publications and highlights relevant parts within them.
250
-
251
- Check out [this video]() for a quick demo of what R2P2 is, and how it can help!
 
 
252
 
253
- -------
254
- """
255
- )
256
 
257
  ### INPUT
258
  with gr.Row() as input_row:
@@ -289,7 +296,7 @@ Check out [this video]() for a quick demo of what R2P2 is, and how it can help!
289
  sent_pair_source1_1 = gr.Textbox(label='Sentence from Submission', visible=False)
290
  sent_pair_source1_1_hl = gr.components.Interpretation(sent_pair_source1_1)
291
  with gr.Column(scale=4):
292
- sent_pair_candidate1_1 = gr.Textbox(label='Sentence from Paper', visible=False)
293
  sent_pair_candidate1_1_hl = gr.components.Interpretation(sent_pair_candidate1_1)
294
  with gr.Row() as rel1_2:
295
  with gr.Column(scale=1):
@@ -298,7 +305,7 @@ Check out [this video]() for a quick demo of what R2P2 is, and how it can help!
298
  sent_pair_source1_2 = gr.Textbox(label='Sentence from Submission', visible=False)
299
  sent_pair_source1_2_hl = gr.components.Interpretation(sent_pair_source1_2)
300
  with gr.Column(scale=4):
301
- sent_pair_candidate1_2 = gr.Textbox(label='Sentence from Paper', visible=False)
302
  sent_pair_candidate1_2_hl = gr.components.Interpretation(sent_pair_candidate1_2)
303
 
304
  with gr.Row(visible=False) as demarc1:
@@ -319,7 +326,7 @@ Check out [this video]() for a quick demo of what R2P2 is, and how it can help!
319
  sent_pair_source2_1 = gr.Textbox(label='Sentence from Submission', visible=False)
320
  sent_pair_source2_1_hl = gr.components.Interpretation(sent_pair_source2_1)
321
  with gr.Column(scale=4):
322
- sent_pair_candidate2_1 = gr.Textbox(label='Sentence from Paper', visible=False)
323
  sent_pair_candidate2_1_hl = gr.components.Interpretation(sent_pair_candidate2_1)
324
  with gr.Row() as rel2_2:
325
  with gr.Column(scale=1):
@@ -328,7 +335,7 @@ Check out [this video]() for a quick demo of what R2P2 is, and how it can help!
328
  sent_pair_source2_2 = gr.Textbox(label='Sentence from Submission', visible=False)
329
  sent_pair_source2_2_hl = gr.components.Interpretation(sent_pair_source2_2)
330
  with gr.Column(scale=4):
331
- sent_pair_candidate2_2 = gr.Textbox(label='Sentence from Paper', visible=False)
332
  sent_pair_candidate2_2_hl = gr.components.Interpretation(sent_pair_candidate2_2)
333
 
334
  with gr.Row(visible=False) as demarc2:
@@ -349,7 +356,7 @@ Check out [this video]() for a quick demo of what R2P2 is, and how it can help!
349
  sent_pair_source3_1 = gr.Textbox(label='Sentence from Submission', visible=False)
350
  sent_pair_source3_1_hl = gr.components.Interpretation(sent_pair_source3_1)
351
  with gr.Column(scale=4):
352
- sent_pair_candidate3_1 = gr.Textbox(label='Sentence from Paper', visible=False)
353
  sent_pair_candidate3_1_hl = gr.components.Interpretation(sent_pair_candidate3_1)
354
  with gr.Row() as rel3_2:
355
  with gr.Column(scale=1):
@@ -358,51 +365,56 @@ Check out [this video]() for a quick demo of what R2P2 is, and how it can help!
358
  sent_pair_source3_2 = gr.Textbox(label='Sentence from Submission', visible=False)
359
  sent_pair_source3_2_hl = gr.components.Interpretation(sent_pair_source3_2)
360
  with gr.Column(scale=4):
361
- sent_pair_candidate3_2 = gr.Textbox(label='Sentence from Paper', visible=False)
362
  sent_pair_candidate3_2_hl = gr.components.Interpretation(sent_pair_candidate3_2)
363
 
364
  ## Show more button
365
  with gr.Row():
366
- see_more_rel_btn = gr.Button('Explore more in other papers', visible=False)
367
 
368
  ### PAPER INFORMATION
369
 
370
- # Description
371
  with gr.Row():
372
- result2_desc = gr.Markdown(
373
- value=''
374
- ,visible=False
375
- )
 
 
 
376
 
 
 
 
377
  # show multiple papers in radio check box to select from
 
378
  with gr.Row():
379
- selected_papers_radio = gr.Radio(
380
- choices=[], # will be udpated with the button click
381
- visible=False, # also will be updated with the button click
382
- label='Top Relevant Papers from the Reviewer'
383
- )
384
-
385
- # selected paper information
386
- with gr.Row(visible=False) as title_row:
387
- with gr.Column(scale=3):
388
- paper_title = gr.Markdown(value='')
389
  with gr.Column(scale=1):
390
- affinity = gr.Markdown(value='')
391
- with gr.Row():
392
- paper_abstract = gr.Textbox(label='Abstract', interactive=False, visible=False)
393
-
394
- ### RELEVANT PARTS (HIGHLIGHTS)
395
- with gr.Row():
396
- with gr.Column(scale=2): # text from submission
397
  source_sentences = gr.Radio(
398
  choices=[],
399
  visible=False,
400
  label='Sentences from Submission Abstract',
401
  )
402
- with gr.Column(scale=3): # highlighted text from paper
403
- highlight = gr.components.Interpretation(paper_abstract)
404
-
405
-
 
 
 
 
 
 
 
 
406
  ### EVENT LISTENERS
407
 
408
  compute_btn.click(
@@ -463,6 +475,7 @@ Check out [this video]() for a quick demo of what R2P2 is, and how it can help!
463
  demarc1,
464
  demarc2,
465
  search_status,
 
466
  info,
467
  ],
468
  show_progress=True,
@@ -478,7 +491,8 @@ Check out [this video]() for a quick demo of what R2P2 is, and how it can help!
478
  selected_papers_radio,
479
  source_sentences,
480
  title_row,
481
- paper_abstract
 
482
  ]
483
  )
484
 
@@ -508,14 +522,5 @@ Check out [this video]() for a quick demo of what R2P2 is, and how it can help!
508
  ]
509
  )
510
 
511
- gr.Markdown(
512
- """
513
- ---------
514
- **Disclaimer.** This tool and its output should not serve as the sole justification for confirming a match for the submission. It is intended as a supplementary tool that the users may use at their discretion; the correctness of the output of the tool is not guaranteed. The search results may be improved by updating the internal models used to compute the affinity scores and sentence relevance, which may require additional independent research. The tool does not compromise the privacy of the reviewers --- it relies only on their publicly-available information (e.g., names and list of previously published papers). All input information will only be temporarily used for internal computation, will not be saved externally, and will be removed when the session is refreshed or closed.
515
- """
516
- )
517
-
518
  if __name__ == "__main__":
519
- #demo.queue().launch(share=True)
520
- demo.queue().launch()
521
- # TODO how to disable dark mode?
 
113
 
114
  # set up elements to show
115
  out = [
116
+ gr.update(choices=display_title, interactive=True), # set of papers (radio)
117
+ gr.update(choices=input_sentences, interactive=True) # submission sentences
118
  ]
119
 
120
  # set up elements to visualize upfront
 
178
  # progress status
179
  out += [gr.update(value='Done (in %0.1f seconds)'%(retrieval_time+highlight_time), visible=True)]
180
 
181
+ # result 2 description
182
+ desc = """
183
+ ##### Click a paper by %s on the left (sorted by affinity scores), and a sentence from the submission on the right, to see which parts the paper are relevant.
184
+ """%results['name']
185
+ out += [gr.update(value=desc)]
186
+
187
  # add the search results to pass on to the Gradio State varaible
188
  out += [results]
189
 
 
192
  def show_more(info):
193
  # show the interactive part of the app
194
  return (
195
+ gr.update(visible=True), # description
 
 
196
  gr.update(visible=True), # set of papers
197
  gr.update(visible=True), # submission sentences
198
  gr.update(visible=True), # title row
199
+ gr.update(visible=True), # affinity row
200
+ gr.update(visible=True), # highlight legend
201
  )
202
 
203
  def show_status():
 
228
  aff_score = info[selected_papers_radio]['doc_score']
229
  highlights = info[selected_papers_radio]['highlight']
230
  url = info[selected_papers_radio]['url']
231
+ title_out = """<a href="%s" target="_blank"><h5>%s</h5></a>"""%(url, title)
232
+ aff_score_out = '##### Affinity Score: %s'%aff_score
233
  return title_out, abstract, aff_score_out, highlights['0']
234
 
235
  else:
 
240
 
241
  # Text description about the app and disclaimer
242
  ### TEXT Description
 
 
 
 
243
 
244
+ # General instruction
245
+ general_instruction = """
246
+ # R2P2: Reviewer TO Paper in Peer review
247
+
248
+ #### Who is it for?
249
  It is for meta-reviewers, area chairs, program chairs, or anyone who oversees the submission-reviewer matching process in peer review for acadmeic conferences, journals, and grants.
250
 
251
  #### How does it help?
252
+ A typical meta-reviewer workflow lacks supportive information on **what makes the pre-selected candidate reviewers a good fit** for the submission. Only affinity scores between the reviewer and the paper are shown, without additional detail.
253
 
254
+ R2P2 provides more information about each reviewer. It searches for the most relevant papers among the reviewer's previous publications and highlights relevant parts within them.
255
+ """
256
+ # TODO add instruction video link
257
+ # More details (video, addendum)
258
+ more_details_instruction = """Check out <a href="", target="_blank">this video</a> for a quick demo of what R2P2 is and how it can help. For more details (e.g., relevant work, privacy policy, disclaimer), refer to <a href="file/details.html", target="_blank">here</a>."""
259
 
260
+ gr.Markdown(general_instruction)
261
+ gr.HTML(more_details_instruction)
262
+ gr.Markdown("""---""")
263
 
264
  ### INPUT
265
  with gr.Row() as input_row:
 
296
  sent_pair_source1_1 = gr.Textbox(label='Sentence from Submission', visible=False)
297
  sent_pair_source1_1_hl = gr.components.Interpretation(sent_pair_source1_1)
298
  with gr.Column(scale=4):
299
+ sent_pair_candidate1_1 = gr.Textbox(label="Sentence from Reviewer's Paper", visible=False)
300
  sent_pair_candidate1_1_hl = gr.components.Interpretation(sent_pair_candidate1_1)
301
  with gr.Row() as rel1_2:
302
  with gr.Column(scale=1):
 
305
  sent_pair_source1_2 = gr.Textbox(label='Sentence from Submission', visible=False)
306
  sent_pair_source1_2_hl = gr.components.Interpretation(sent_pair_source1_2)
307
  with gr.Column(scale=4):
308
+ sent_pair_candidate1_2 = gr.Textbox(label="Sentence from Reviewer's Paper", visible=False)
309
  sent_pair_candidate1_2_hl = gr.components.Interpretation(sent_pair_candidate1_2)
310
 
311
  with gr.Row(visible=False) as demarc1:
 
326
  sent_pair_source2_1 = gr.Textbox(label='Sentence from Submission', visible=False)
327
  sent_pair_source2_1_hl = gr.components.Interpretation(sent_pair_source2_1)
328
  with gr.Column(scale=4):
329
+ sent_pair_candidate2_1 = gr.Textbox(label="Sentence from Reviewer's Paper", visible=False)
330
  sent_pair_candidate2_1_hl = gr.components.Interpretation(sent_pair_candidate2_1)
331
  with gr.Row() as rel2_2:
332
  with gr.Column(scale=1):
 
335
  sent_pair_source2_2 = gr.Textbox(label='Sentence from Submission', visible=False)
336
  sent_pair_source2_2_hl = gr.components.Interpretation(sent_pair_source2_2)
337
  with gr.Column(scale=4):
338
+ sent_pair_candidate2_2 = gr.Textbox(label="Sentence from Reviewer's Paper", visible=False)
339
  sent_pair_candidate2_2_hl = gr.components.Interpretation(sent_pair_candidate2_2)
340
 
341
  with gr.Row(visible=False) as demarc2:
 
356
  sent_pair_source3_1 = gr.Textbox(label='Sentence from Submission', visible=False)
357
  sent_pair_source3_1_hl = gr.components.Interpretation(sent_pair_source3_1)
358
  with gr.Column(scale=4):
359
+ sent_pair_candidate3_1 = gr.Textbox(label="Sentence from Reviewer's Paper", visible=False)
360
  sent_pair_candidate3_1_hl = gr.components.Interpretation(sent_pair_candidate3_1)
361
  with gr.Row() as rel3_2:
362
  with gr.Column(scale=1):
 
365
  sent_pair_source3_2 = gr.Textbox(label='Sentence from Submission', visible=False)
366
  sent_pair_source3_2_hl = gr.components.Interpretation(sent_pair_source3_2)
367
  with gr.Column(scale=4):
368
+ sent_pair_candidate3_2 = gr.Textbox(label="Sentence from Reviewer's Paper", visible=False)
369
  sent_pair_candidate3_2_hl = gr.components.Interpretation(sent_pair_candidate3_2)
370
 
371
  ## Show more button
372
  with gr.Row():
373
+ see_more_rel_btn = gr.Button('Explore more', visible=False)
374
 
375
  ### PAPER INFORMATION
376
 
377
+ # Description for Explore More Section
378
  with gr.Row():
379
+ result2_desc = gr.Markdown(value='', visible=False)
380
+
381
+ # Highlight description
382
+ hl_desc = """
383
+ **<span style="color:black;background-color:#DB7262;">Red</span>**: sentences simiar to the selected sentence from submission. Darker = more similar.
384
+
385
+ **<span style="color:black;background-color:#65B5E3;">Blue</span>**: phrases that appear in both sentences.
386
 
387
+ ---
388
+ """
389
+
390
  # show multiple papers in radio check box to select from
391
+ paper_abstract = gr.Textbox(label='Abstract', interactive=False, visible=False)
392
  with gr.Row():
 
 
 
 
 
 
 
 
 
 
393
  with gr.Column(scale=1):
394
+ selected_papers_radio = gr.Radio(
395
+ choices=[], # will be udpated with the button click
396
+ visible=False, # also will be updated with the button click
397
+ label='Top Relevant Papers from the Reviewer'
398
+ )
399
+ with gr.Column(scale=2):
400
+ # sentences from submission
401
  source_sentences = gr.Radio(
402
  choices=[],
403
  visible=False,
404
  label='Sentences from Submission Abstract',
405
  )
406
+ with gr.Column(scale=3):
407
+ # selected paper and highlight
408
+ with gr.Row():
409
+ highlight_legend = gr.Markdown(value=hl_desc, visible=False)
410
+ with gr.Row(visible=False) as title_row:
411
+ paper_title = gr.Markdown(value='')
412
+ with gr.Row(visible=False) as aff_row:
413
+ affinity = gr.Markdown(value='')
414
+ with gr.Row():
415
+ # highlighted text from paper
416
+ highlight = gr.components.Interpretation(paper_abstract)
417
+
418
  ### EVENT LISTENERS
419
 
420
  compute_btn.click(
 
475
  demarc1,
476
  demarc2,
477
  search_status,
478
+ result2_desc,
479
  info,
480
  ],
481
  show_progress=True,
 
491
  selected_papers_radio,
492
  source_sentences,
493
  title_row,
494
+ aff_row,
495
+ highlight_legend,
496
  ]
497
  )
498
 
 
522
  ]
523
  )
524
 
 
 
 
 
 
 
 
525
  if __name__ == "__main__":
526
+ demo.queue().launch() # add ?__theme=light to force light mode
 
 
details.html ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <body>
4
+
5
+ <h1>Relevant Work</h1>
6
+
7
+ The tool is based on the findings from the paper <a href="https://arxiv.org/abs/2302.08450", target="_blank">Assisting Human Decisions in Document Matching</a>.
8
+
9
+ <h1>What Happens Behind the Scenes</h1>
10
+ <ul>
11
+ <li> The tool retrieves the reviewer's previous publications using <a href="https://www.semanticscholar.org/product/api", target="_blank">Semantic Scholar API</a>.</li>
12
+ <li> The tool computes the affinity score between the submission abstract and each paper's abstract, using text representations from a <a href="https://github.com/allenai/specter/tree/master/specter", target="_blank">language model fine-tuned on academic papers</a>.</li>
13
+ <li> The tool computes pairwise sentence relevance scores between the submission abstract and the reviewer paper's abstract, using text representations from a <a href="https://huggingface.co/sentence-transformers/gtr-t5-base", target="_blank">sentence-level langauge model</a>.</li>
14
+ <li> The tool highlights overlapping words (nouns) between setence pairs using <a href="https://www.nltk.org/book/ch05.html", target="_blank">POS tagging</a>.</li>
15
+ </ul>
16
+
17
+ <h1>Privacy Policy</h1>
18
+
19
+ The tool does not compromise the privacy of the reviewers. It only relies only on their publicly-available information (e.g., names and list of previously published papers). All input information will only be temporarily used for internal computation, will not be saved externally, and will be deleted when the session is refreshed or closed. No search history will be kept.
20
+
21
+ <h1>Disclaimer</h1>
22
+
23
+ This tool and its output should not serve as the sole justification for confirming a match for the submission. It is intended as a <b>supplementary</b> tool that the users may use at their discretion. The correctness of the output of the tool is not guaranteed. The search results may be improved by updating the internal models used to compute the affinity scores and sentence relevance, which may require additional independent research and experimentation.
24
+ </body>
25
+ </html>
score.py CHANGED
@@ -259,7 +259,8 @@ def predict_docscore(doc_model, tokenizer, query, titles, abstracts, batch=20):
259
  title_abs = []
260
  for t, a in zip(titles, abstracts):
261
  if t is not None and a is not None:
262
- title_abs.append(t + ' [SEP] ' + a)
 
263
 
264
  num_docs = len(title_abs)
265
  no_iter = int(np.ceil(num_docs / batch))
 
259
  title_abs = []
260
  for t, a in zip(titles, abstracts):
261
  if t is not None and a is not None:
262
+ # title_abs.append(t + ' [SEP] ' + a)
263
+ title_abs.append(a)
264
 
265
  num_docs = len(title_abs)
266
  no_iter = int(np.ceil(num_docs / batch))