Update app.py
Browse files
app.py
CHANGED
|
@@ -43,35 +43,38 @@ def generate_summary(text, style):
|
|
| 43 |
|
| 44 |
custom_css = """
|
| 45 |
#header {text-align: center; margin-bottom: 25px;}
|
| 46 |
-
.gradio-container {max-width:
|
| 47 |
footer {display: none !important;}
|
| 48 |
"""
|
| 49 |
|
| 50 |
with gr.Blocks() as demo:
|
| 51 |
with gr.Column(elem_id="header"):
|
| 52 |
gr.Markdown("# Style Summarizer")
|
| 53 |
-
gr.Markdown("
|
| 54 |
|
| 55 |
with gr.Row():
|
| 56 |
with gr.Column(scale=1):
|
| 57 |
input_box = gr.Textbox(
|
| 58 |
label="Input Text",
|
| 59 |
placeholder="Enter text to be summarized...",
|
| 60 |
-
lines=
|
| 61 |
)
|
| 62 |
style_radio = gr.Radio(
|
| 63 |
choices=["harsh", "standard", "detailed"],
|
| 64 |
label="Summary Type",
|
| 65 |
value="standard"
|
| 66 |
)
|
| 67 |
-
|
|
|
|
|
|
|
| 68 |
|
| 69 |
with gr.Column(scale=1):
|
| 70 |
output_box = gr.Textbox(
|
| 71 |
label="Output Summary",
|
| 72 |
-
lines=
|
| 73 |
interactive=False
|
| 74 |
)
|
|
|
|
| 75 |
|
| 76 |
submit_btn.click(
|
| 77 |
fn=generate_summary,
|
|
@@ -79,4 +82,17 @@ with gr.Blocks() as demo:
|
|
| 79 |
outputs=output_box
|
| 80 |
)
|
| 81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
demo.launch(css=custom_css, theme=gr.themes.Base())
|
|
|
|
| 43 |
|
| 44 |
custom_css = """
|
| 45 |
#header {text-align: center; margin-bottom: 25px;}
|
| 46 |
+
.gradio-container {max-width: 95% !important;}
|
| 47 |
footer {display: none !important;}
|
| 48 |
"""
|
| 49 |
|
| 50 |
with gr.Blocks() as demo:
|
| 51 |
with gr.Column(elem_id="header"):
|
| 52 |
gr.Markdown("# Style Summarizer")
|
| 53 |
+
gr.Markdown("Professional document summarization interface.")
|
| 54 |
|
| 55 |
with gr.Row():
|
| 56 |
with gr.Column(scale=1):
|
| 57 |
input_box = gr.Textbox(
|
| 58 |
label="Input Text",
|
| 59 |
placeholder="Enter text to be summarized...",
|
| 60 |
+
lines=15
|
| 61 |
)
|
| 62 |
style_radio = gr.Radio(
|
| 63 |
choices=["harsh", "standard", "detailed"],
|
| 64 |
label="Summary Type",
|
| 65 |
value="standard"
|
| 66 |
)
|
| 67 |
+
with gr.Row():
|
| 68 |
+
clear_btn = gr.Button("Clear Input")
|
| 69 |
+
submit_btn = gr.Button("Process Summary", variant="primary")
|
| 70 |
|
| 71 |
with gr.Column(scale=1):
|
| 72 |
output_box = gr.Textbox(
|
| 73 |
label="Output Summary",
|
| 74 |
+
lines=18,
|
| 75 |
interactive=False
|
| 76 |
)
|
| 77 |
+
copy_btn = gr.Button("Copy to Clipboard")
|
| 78 |
|
| 79 |
submit_btn.click(
|
| 80 |
fn=generate_summary,
|
|
|
|
| 82 |
outputs=output_box
|
| 83 |
)
|
| 84 |
|
| 85 |
+
clear_btn.click(
|
| 86 |
+
fn=lambda: "",
|
| 87 |
+
inputs=None,
|
| 88 |
+
outputs=input_box
|
| 89 |
+
)
|
| 90 |
+
|
| 91 |
+
# This uses JavaScript for the copy functionality to bypass version limitations
|
| 92 |
+
copy_btn.click(
|
| 93 |
+
fn=None,
|
| 94 |
+
inputs=[output_box],
|
| 95 |
+
js="(v) => { navigator.clipboard.writeText(v); alert('Summary copied to clipboard'); }"
|
| 96 |
+
)
|
| 97 |
+
|
| 98 |
demo.launch(css=custom_css, theme=gr.themes.Base())
|