qolina commited on
Commit
51fcf70
1 Parent(s): ad2fcfd

Update app.py

Browse files

change position of refstring and summ

Files changed (1) hide show
  1. app.py +35 -35
app.py CHANGED
@@ -7,6 +7,41 @@ from controlled_summarization import *
7
  with gr.Blocks(css="#htext span {white-space: pre-line}") as demo:
8
  gr.Markdown("# Gradio Demo for SciAssist")
9
  with gr.Tabs():
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  # Reference String Parsing
11
  with gr.TabItem("Reference String Parsing"):
12
  with gr.Box():
@@ -59,40 +94,5 @@ with gr.Blocks(css="#htext span {white-space: pre-line}") as demo:
59
  outputs=rsp_str_output
60
  )
61
 
62
- # Controlled Summarization
63
- with gr.TabItem("Summarization"):
64
-
65
- with gr.Box():
66
- gr.Markdown(ctrlsum_file_md)
67
- with gr.Row():
68
- with gr.Column():
69
- ctrlsum_file = gr.File(label="Input File")
70
- ctrlsum_str = gr.TextArea(label="Input String")
71
- with gr.Column():
72
- gr.Markdown("* Length 0 will exert no control over length.")
73
- # ctrlsum_file_beams = gr.Number(label="Number of beams for beam search", value=1, precision=0)
74
- # ctrlsum_file_sequences = gr.Number(label="Number of generated summaries", value=1, precision=0)
75
- ctrlsum_file_length = gr.Slider(0,300,step=50, label="Length")
76
- ctrlsum_file_keywords = gr.Textbox(label="Keywords",max_lines=1)
77
- with gr.Row():
78
- ctrlsum_file_btn = gr.Button("Generate")
79
- ctrlsum_file_output = gr.Textbox(
80
- elem_id="htext",
81
- label="Summary",
82
- )
83
- ctrlsum_file_examples = gr.Examples(examples=[["examples/BERT_body.txt", 100, "", ""],["examples/BERT_paper.pdf", 0, "BERT"]],
84
- inputs=[ctrlsum_file, ctrlsum_file_length, ctrlsum_file_keywords])
85
-
86
- ctrlsum_file_btn.click(
87
- fn=ctrlsum_for_file,
88
- inputs=[ctrlsum_file, ctrlsum_file_length, ctrlsum_file_keywords, ctrlsum_str],
89
- outputs=[ctrlsum_file_output, ctrlsum_str]
90
- )
91
- def clear():
92
- return None,0,None
93
-
94
- ctrlsum_file.change(clear, inputs=None,outputs=[ctrlsum_str,ctrlsum_file_length,ctrlsum_file_keywords])
95
-
96
-
97
 
98
  demo.launch(share=False)
 
7
  with gr.Blocks(css="#htext span {white-space: pre-line}") as demo:
8
  gr.Markdown("# Gradio Demo for SciAssist")
9
  with gr.Tabs():
10
+
11
+ # Controlled Summarization
12
+ with gr.TabItem("Summarization"):
13
+
14
+ with gr.Box():
15
+ gr.Markdown(ctrlsum_file_md)
16
+ with gr.Row():
17
+ with gr.Column():
18
+ ctrlsum_file = gr.File(label="Input File")
19
+ ctrlsum_str = gr.TextArea(label="Input String")
20
+ with gr.Column():
21
+ gr.Markdown("* Length 0 will exert no control over length.")
22
+ # ctrlsum_file_beams = gr.Number(label="Number of beams for beam search", value=1, precision=0)
23
+ # ctrlsum_file_sequences = gr.Number(label="Number of generated summaries", value=1, precision=0)
24
+ ctrlsum_file_length = gr.Slider(0,300,step=50, label="Length")
25
+ ctrlsum_file_keywords = gr.Textbox(label="Keywords",max_lines=1)
26
+ with gr.Row():
27
+ ctrlsum_file_btn = gr.Button("Generate")
28
+ ctrlsum_file_output = gr.Textbox(
29
+ elem_id="htext",
30
+ label="Summary",
31
+ )
32
+ ctrlsum_file_examples = gr.Examples(examples=[["examples/BERT_body.txt", 100, "", ""],["examples/BERT_paper.pdf", 0, "BERT"]],
33
+ inputs=[ctrlsum_file, ctrlsum_file_length, ctrlsum_file_keywords])
34
+
35
+ ctrlsum_file_btn.click(
36
+ fn=ctrlsum_for_file,
37
+ inputs=[ctrlsum_file, ctrlsum_file_length, ctrlsum_file_keywords, ctrlsum_str],
38
+ outputs=[ctrlsum_file_output, ctrlsum_str]
39
+ )
40
+ def clear():
41
+ return None,0,None
42
+
43
+ ctrlsum_file.change(clear, inputs=None,outputs=[ctrlsum_str,ctrlsum_file_length,ctrlsum_file_keywords])
44
+
45
  # Reference String Parsing
46
  with gr.TabItem("Reference String Parsing"):
47
  with gr.Box():
 
94
  outputs=rsp_str_output
95
  )
96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
 
98
  demo.launch(share=False)