Update app.py
Browse files
app.py
CHANGED
|
@@ -96,10 +96,15 @@ def proc_submission(
|
|
| 96 |
f" - Section {i}: {round(s['summary_score'],4)}"
|
| 97 |
for i, s in enumerate(_summaries)
|
| 98 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
|
| 100 |
sum_text_out = "\n".join(sum_text)
|
| 101 |
history["Summary Scores"] = "<br><br>"
|
| 102 |
scores_out = "\n".join(sum_scores)
|
|
|
|
| 103 |
rt = round((time.perf_counter() - st) / 60, 2)
|
| 104 |
print(f"Runtime: {rt} minutes")
|
| 105 |
html = ""
|
|
@@ -109,7 +114,7 @@ def proc_submission(
|
|
| 109 |
|
| 110 |
html += ""
|
| 111 |
|
| 112 |
-
return html, sum_text_out, scores_out
|
| 113 |
|
| 114 |
|
| 115 |
def load_single_example_text(
|
|
@@ -244,9 +249,14 @@ if __name__ == "__main__":
|
|
| 244 |
"The summary scores can be thought of as representing the quality of the summary. less-negative numbers (closer to 0) are better:"
|
| 245 |
)
|
| 246 |
summary_scores = gr.Textbox(
|
| 247 |
-
label="Summary Scores", placeholder="Summary scores will appear here"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 248 |
)
|
| 249 |
-
|
| 250 |
gr.Markdown("---")
|
| 251 |
|
| 252 |
with gr.Column():
|
|
@@ -276,7 +286,7 @@ if __name__ == "__main__":
|
|
| 276 |
token_batch_length,
|
| 277 |
length_penalty,
|
| 278 |
],
|
| 279 |
-
outputs=[output_text, summary_text, summary_scores],
|
| 280 |
)
|
| 281 |
|
| 282 |
demo.launch(enable_queue=True, share=False)
|
|
|
|
| 96 |
f" - Section {i}: {round(s['summary_score'],4)}"
|
| 97 |
for i, s in enumerate(_summaries)
|
| 98 |
]
|
| 99 |
+
rates = [
|
| 100 |
+
f" - Section {i}: {round(s['compression_rate'],3)}"
|
| 101 |
+
for i, s in enumerate(_summaries)
|
| 102 |
+
]
|
| 103 |
|
| 104 |
sum_text_out = "\n".join(sum_text)
|
| 105 |
history["Summary Scores"] = "<br><br>"
|
| 106 |
scores_out = "\n".join(sum_scores)
|
| 107 |
+
rates_out = "\n".join(rates)
|
| 108 |
rt = round((time.perf_counter() - st) / 60, 2)
|
| 109 |
print(f"Runtime: {rt} minutes")
|
| 110 |
html = ""
|
|
|
|
| 114 |
|
| 115 |
html += ""
|
| 116 |
|
| 117 |
+
return html, sum_text_out, scores_out, rates_out
|
| 118 |
|
| 119 |
|
| 120 |
def load_single_example_text(
|
|
|
|
| 249 |
"The summary scores can be thought of as representing the quality of the summary. less-negative numbers (closer to 0) are better:"
|
| 250 |
)
|
| 251 |
summary_scores = gr.Textbox(
|
| 252 |
+
label="Summary Scores ", placeholder="Summary scores will appear here"
|
| 253 |
+
)
|
| 254 |
+
gr.Markdown(
|
| 255 |
+
"The compression rate indicates the ratio between the machine-generated summary length and the input text (from 0% to 100%). The higher the compression rate the more extreme the summary is."
|
| 256 |
+
)
|
| 257 |
+
compression_rate = gr.Textbox(
|
| 258 |
+
label="Compression rate π", placeholder="The π will appear here"
|
| 259 |
)
|
|
|
|
| 260 |
gr.Markdown("---")
|
| 261 |
|
| 262 |
with gr.Column():
|
|
|
|
| 286 |
token_batch_length,
|
| 287 |
length_penalty,
|
| 288 |
],
|
| 289 |
+
outputs=[output_text, summary_text, summary_scores, rates],
|
| 290 |
)
|
| 291 |
|
| 292 |
demo.launch(enable_queue=True, share=False)
|