jskim commited on
Commit
dedd4f7
·
1 Parent(s): 7269ffa

relevance scores in markdown

Browse files
Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -129,7 +129,8 @@ def get_similar_paper(
129
  tp = results[display_title[i]]['top_pairs']
130
  for j in range(top_num_info_show):
131
  out_tmp += [
132
- gr.update(value='%0.3f'%tp[j]['score'], visible=True), # sentence relevance
 
133
  tp[j]['query']['original'],
134
  tp[j]['query'],
135
  tp[j]['candidate']['original'],
@@ -202,6 +203,7 @@ with gr.Blocks() as demo:
202
  # Text description about the app and disclaimer
203
  ### TEXT Description
204
  # TODO add instruction video link
 
205
  gr.Markdown(
206
  """
207
  # Paper Matching Helper
@@ -251,6 +253,7 @@ Below we describe how to use the tool. Also feel free to check out [this video](
251
  # Paper title, score, and top-ranking sentence pairs -- two sentence pairs per paper, three papers
252
  ## ONE BLOCK OF INFO FOR A SINGLE PAPER
253
  ## PAPER1
 
254
  with gr.Row():
255
  with gr.Column(scale=3):
256
  paper_title1 = gr.Markdown(value='', visible=False)
@@ -258,7 +261,7 @@ Below we describe how to use the tool. Also feel free to check out [this video](
258
  affinity1 = gr.Markdown(value='', visible=False)
259
  with gr.Row() as rel1_1:
260
  with gr.Column(scale=1):
261
- sent_pair_score1_1 = gr.Textbox(label='Sentence Relevance', interactive=False, value='', visible=False)
262
  with gr.Column(scale=4):
263
  sent_pair_source1_1 = gr.Textbox(label='Sentence from Submission', visible=False)
264
  sent_pair_source1_1_hl = gr.components.Interpretation(sent_pair_source1_1)
@@ -267,7 +270,7 @@ Below we describe how to use the tool. Also feel free to check out [this video](
267
  sent_pair_candidate1_1_hl = gr.components.Interpretation(sent_pair_candidate1_1)
268
  with gr.Row() as rel1_2:
269
  with gr.Column(scale=1):
270
- sent_pair_score1_2 = gr.Textbox(label='Sentence Relevance', interactive=False, value='', visible=False)
271
  with gr.Column(scale=4):
272
  sent_pair_source1_2 = gr.Textbox(label='Sentence from Submission', visible=False)
273
  sent_pair_source1_2_hl = gr.components.Interpretation(sent_pair_source1_2)
@@ -289,7 +292,7 @@ Below we describe how to use the tool. Also feel free to check out [this video](
289
  affinity2 = gr.Markdown(value='', visible=False)
290
  with gr.Row() as rel2_1:
291
  with gr.Column(scale=1):
292
- sent_pair_score2_1 = gr.Textbox(label='Sentence Relevance', interactive=False, value='', visible=False)
293
  with gr.Column(scale=4):
294
  sent_pair_source2_1 = gr.Textbox(label='Sentence from Submission', visible=False)
295
  sent_pair_source2_1_hl = gr.components.Interpretation(sent_pair_source2_1)
@@ -298,7 +301,7 @@ Below we describe how to use the tool. Also feel free to check out [this video](
298
  sent_pair_candidate2_1_hl = gr.components.Interpretation(sent_pair_candidate2_1)
299
  with gr.Row() as rel2_2:
300
  with gr.Column(scale=1):
301
- sent_pair_score2_2 = gr.Textbox(label='Sentence Relevance', interactive=False, value='', visible=False)
302
  with gr.Column(scale=4):
303
  sent_pair_source2_2 = gr.Textbox(label='Sentence from Submission', visible=False)
304
  sent_pair_source2_2_hl = gr.components.Interpretation(sent_pair_source2_2)
@@ -320,7 +323,7 @@ Below we describe how to use the tool. Also feel free to check out [this video](
320
  affinity3 = gr.Markdown(value='', visible=False)
321
  with gr.Row() as rel3_1:
322
  with gr.Column(scale=1):
323
- sent_pair_score3_1 = gr.Textbox(label='Sentence Relevance', interactive=False, value='', visible=False)
324
  with gr.Column(scale=4):
325
  sent_pair_source3_1 = gr.Textbox(label='Sentence from Submission', visible=False)
326
  sent_pair_source3_1_hl = gr.components.Interpretation(sent_pair_source3_1)
@@ -329,7 +332,7 @@ Below we describe how to use the tool. Also feel free to check out [this video](
329
  sent_pair_candidate3_1_hl = gr.components.Interpretation(sent_pair_candidate3_1)
330
  with gr.Row() as rel3_2:
331
  with gr.Column(scale=1):
332
- sent_pair_score3_2 = gr.Textbox(label='Sentence Relevance', interactive=False, value='', visible=False)
333
  with gr.Column(scale=4):
334
  sent_pair_source3_2 = gr.Textbox(label='Sentence from Submission', visible=False)
335
  sent_pair_source3_2_hl = gr.components.Interpretation(sent_pair_source3_2)
@@ -484,4 +487,6 @@ Below we describe how to use the tool. Also feel free to check out [this video](
484
  )
485
 
486
  if __name__ == "__main__":
 
487
  demo.queue().launch()
 
 
129
  tp = results[display_title[i]]['top_pairs']
130
  for j in range(top_num_info_show):
131
  out_tmp += [
132
+ #gr.update(value='%0.3f'%tp[j]['score'], visible=True), # sentence relevance
133
+ gr.update(value='Sentence Relevance:\n%0.3f'%tp[j]['score'], visible=True), # sentence relevance
134
  tp[j]['query']['original'],
135
  tp[j]['query'],
136
  tp[j]['candidate']['original'],
 
203
  # Text description about the app and disclaimer
204
  ### TEXT Description
205
  # TODO add instruction video link
206
+ # TODO shorten the instruction and make it clearer
207
  gr.Markdown(
208
  """
209
  # Paper Matching Helper
 
253
  # Paper title, score, and top-ranking sentence pairs -- two sentence pairs per paper, three papers
254
  ## ONE BLOCK OF INFO FOR A SINGLE PAPER
255
  ## PAPER1
256
+ # TODO hovering instructions
257
  with gr.Row():
258
  with gr.Column(scale=3):
259
  paper_title1 = gr.Markdown(value='', visible=False)
 
261
  affinity1 = gr.Markdown(value='', visible=False)
262
  with gr.Row() as rel1_1:
263
  with gr.Column(scale=1):
264
+ sent_pair_score1_1 = gr.Markdown(interactive=False, value='', visible=False)
265
  with gr.Column(scale=4):
266
  sent_pair_source1_1 = gr.Textbox(label='Sentence from Submission', visible=False)
267
  sent_pair_source1_1_hl = gr.components.Interpretation(sent_pair_source1_1)
 
270
  sent_pair_candidate1_1_hl = gr.components.Interpretation(sent_pair_candidate1_1)
271
  with gr.Row() as rel1_2:
272
  with gr.Column(scale=1):
273
+ sent_pair_score1_2 = gr.Markdown(interactive=False, value='', visible=False)
274
  with gr.Column(scale=4):
275
  sent_pair_source1_2 = gr.Textbox(label='Sentence from Submission', visible=False)
276
  sent_pair_source1_2_hl = gr.components.Interpretation(sent_pair_source1_2)
 
292
  affinity2 = gr.Markdown(value='', visible=False)
293
  with gr.Row() as rel2_1:
294
  with gr.Column(scale=1):
295
+ sent_pair_score2_1 = gr.Markdown(interactive=False, value='', visible=False)
296
  with gr.Column(scale=4):
297
  sent_pair_source2_1 = gr.Textbox(label='Sentence from Submission', visible=False)
298
  sent_pair_source2_1_hl = gr.components.Interpretation(sent_pair_source2_1)
 
301
  sent_pair_candidate2_1_hl = gr.components.Interpretation(sent_pair_candidate2_1)
302
  with gr.Row() as rel2_2:
303
  with gr.Column(scale=1):
304
+ sent_pair_score2_2 = gr.Markdown(interactive=False, value='', visible=False)
305
  with gr.Column(scale=4):
306
  sent_pair_source2_2 = gr.Textbox(label='Sentence from Submission', visible=False)
307
  sent_pair_source2_2_hl = gr.components.Interpretation(sent_pair_source2_2)
 
323
  affinity3 = gr.Markdown(value='', visible=False)
324
  with gr.Row() as rel3_1:
325
  with gr.Column(scale=1):
326
+ sent_pair_score3_1 = gr.Markdown(interactive=False, value='', visible=False)
327
  with gr.Column(scale=4):
328
  sent_pair_source3_1 = gr.Textbox(label='Sentence from Submission', visible=False)
329
  sent_pair_source3_1_hl = gr.components.Interpretation(sent_pair_source3_1)
 
332
  sent_pair_candidate3_1_hl = gr.components.Interpretation(sent_pair_candidate3_1)
333
  with gr.Row() as rel3_2:
334
  with gr.Column(scale=1):
335
+ sent_pair_score3_2 = gr.Markdown(interactive=False, value='', visible=False)
336
  with gr.Column(scale=4):
337
  sent_pair_source3_2 = gr.Textbox(label='Sentence from Submission', visible=False)
338
  sent_pair_source3_2_hl = gr.components.Interpretation(sent_pair_source3_2)
 
487
  )
488
 
489
  if __name__ == "__main__":
490
+ #demo.queue().launch(share=True)
491
  demo.queue().launch()
492
+ # TODO how to disable dark mode?