Update app.py
Browse files
app.py
CHANGED
|
@@ -41,15 +41,43 @@ def generate_summary(text, style):
|
|
| 41 |
)
|
| 42 |
return output[0]["summary_text"]
|
| 43 |
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
demo.launch()
|
|
|
|
| 41 |
)
|
| 42 |
return output[0]["summary_text"]
|
| 43 |
|
| 44 |
+
custom_css = """
|
| 45 |
+
#header {text-align: center; margin-bottom: 25px;}
|
| 46 |
+
.gradio-container {max-width: 1000px !important;}
|
| 47 |
+
footer {display: none !important;}
|
| 48 |
+
"""
|
| 49 |
+
|
| 50 |
+
with gr.Blocks(css=custom_css, theme=gr.themes.Base()) as demo:
|
| 51 |
+
with gr.Column(elem_id="header"):
|
| 52 |
+
gr.Markdown("# Style Summarizer")
|
| 53 |
+
gr.Markdown("Fine-tuned Flan-T5 model for multi-style document summarization.")
|
| 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=12
|
| 61 |
+
)
|
| 62 |
+
style_radio = gr.Radio(
|
| 63 |
+
choices=["harsh", "standard", "detailed"],
|
| 64 |
+
label="Summary Type",
|
| 65 |
+
value="standard"
|
| 66 |
+
)
|
| 67 |
+
submit_btn = gr.Button("Process Summary", variant="primary")
|
| 68 |
+
|
| 69 |
+
with gr.Column(scale=1):
|
| 70 |
+
output_box = gr.Textbox(
|
| 71 |
+
label="Output Summary",
|
| 72 |
+
lines=15,
|
| 73 |
+
interactive=False,
|
| 74 |
+
show_copy_button=True
|
| 75 |
+
)
|
| 76 |
+
|
| 77 |
+
submit_btn.click(
|
| 78 |
+
fn=generate_summary,
|
| 79 |
+
inputs=[input_box, style_radio],
|
| 80 |
+
outputs=output_box
|
| 81 |
+
)
|
| 82 |
|
| 83 |
demo.launch()
|