Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
๐ธ improve UI and add guide
Browse filesSigned-off-by: peter szemraj <[email protected]>
app.py
CHANGED
@@ -307,12 +307,15 @@ if __name__ == "__main__":
|
|
307 |
with demo:
|
308 |
gr.Markdown("# Document Summarization with Long-Document Transformers")
|
309 |
gr.Markdown(
|
310 |
-
"
|
311 |
)
|
312 |
with gr.Column():
|
313 |
gr.Markdown("## Load Inputs & Select Parameters")
|
314 |
gr.Markdown(
|
315 |
-
"Enter text below
|
|
|
|
|
|
|
316 |
)
|
317 |
with gr.Row(variant="compact"):
|
318 |
with gr.Column(scale=0.5, variant="compact"):
|
@@ -353,22 +356,20 @@ if __name__ == "__main__":
|
|
353 |
with gr.Column():
|
354 |
gr.Markdown("## Generate Summary")
|
355 |
gr.Markdown(
|
356 |
-
"
|
357 |
)
|
358 |
summarize_button = gr.Button(
|
359 |
"Summarize!",
|
360 |
variant="primary",
|
361 |
)
|
362 |
-
|
363 |
output_text = gr.HTML("<p><em>Output will appear below:</em></p>")
|
364 |
-
gr.Markdown("### **Summary Output**")
|
365 |
-
summary_text = gr.HTML(
|
366 |
-
label="Summary", value="<i>Summary will appear here!</i>"
|
367 |
-
)
|
368 |
with gr.Column():
|
369 |
-
gr.Markdown("####
|
370 |
with gr.Row():
|
371 |
with gr.Column(variant="compact"):
|
|
|
|
|
|
|
372 |
text_file = gr.File(
|
373 |
label="Download as Text File",
|
374 |
file_count="single",
|
@@ -384,9 +385,16 @@ if __name__ == "__main__":
|
|
384 |
placeholder="Summary scores will appear here",
|
385 |
)
|
386 |
|
|
|
|
|
|
|
|
|
387 |
gr.Markdown("---")
|
388 |
with gr.Column():
|
389 |
gr.Markdown("### Advanced Settings")
|
|
|
|
|
|
|
390 |
with gr.Row(variant="compact"):
|
391 |
length_penalty = gr.Slider(
|
392 |
minimum=0.5,
|
|
|
307 |
with demo:
|
308 |
gr.Markdown("# Document Summarization with Long-Document Transformers")
|
309 |
gr.Markdown(
|
310 |
+
"An example use case for fine-tuned long document transformers. Model(s) are trained on [book summaries](https://huggingface.co/datasets/kmfoda/booksum). Architectures in this demo are [LongT5-base](https://huggingface.co/pszemraj/long-t5-tglobal-base-16384-book-summary) and [Pegasus-X-Large](https://huggingface.co/pszemraj/pegasus-x-large-book-summary)."
|
311 |
)
|
312 |
with gr.Column():
|
313 |
gr.Markdown("## Load Inputs & Select Parameters")
|
314 |
gr.Markdown(
|
315 |
+
"""Enter/paste text below, or upload a file. Pick a model & adjust params (_optional_), and press **Summarize!**
|
316 |
+
|
317 |
+
See [the guide doc](https://gist.github.com/pszemraj/722a7ba443aa3a671b02d87038375519) for details.
|
318 |
+
"""
|
319 |
)
|
320 |
with gr.Row(variant="compact"):
|
321 |
with gr.Column(scale=0.5, variant="compact"):
|
|
|
356 |
with gr.Column():
|
357 |
gr.Markdown("## Generate Summary")
|
358 |
gr.Markdown(
|
359 |
+
"_Summarization should take ~1-2 minutes for most settings, but may extend up to 5-10 minutes in some scenarios._"
|
360 |
)
|
361 |
summarize_button = gr.Button(
|
362 |
"Summarize!",
|
363 |
variant="primary",
|
364 |
)
|
|
|
365 |
output_text = gr.HTML("<p><em>Output will appear below:</em></p>")
|
|
|
|
|
|
|
|
|
366 |
with gr.Column():
|
367 |
+
gr.Markdown("#### Results & Scores")
|
368 |
with gr.Row():
|
369 |
with gr.Column(variant="compact"):
|
370 |
+
gr.Markdown(
|
371 |
+
"Download the summary as a text file, with parameters and scores."
|
372 |
+
)
|
373 |
text_file = gr.File(
|
374 |
label="Download as Text File",
|
375 |
file_count="single",
|
|
|
385 |
placeholder="Summary scores will appear here",
|
386 |
)
|
387 |
|
388 |
+
gr.Markdown("#### **Summary Output**")
|
389 |
+
summary_text = gr.HTML(
|
390 |
+
label="Summary", value="<i>Summary will appear here!</i>"
|
391 |
+
)
|
392 |
gr.Markdown("---")
|
393 |
with gr.Column():
|
394 |
gr.Markdown("### Advanced Settings")
|
395 |
+
gr.Markdown(
|
396 |
+
"Refer to [the guide doc](https://gist.github.com/pszemraj/722a7ba443aa3a671b02d87038375519) for what these are, and how they impact _quality_ and _speed_."
|
397 |
+
)
|
398 |
with gr.Row(variant="compact"):
|
399 |
length_penalty = gr.Slider(
|
400 |
minimum=0.5,
|