Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -9,9 +9,21 @@ def summarize_text(input_text):
|
|
9 |
summarized_text = summarizer(input_text, max_length=128, min_length=64, do_sample=False , wait_for_model = True)
|
10 |
return summarized_text[0]['summary_text']
|
11 |
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
inputs=gr.inputs.Textbox(label="Enter the text to summarize"),
|
15 |
outputs=gr.outputs.Textbox(label="Summarized Text"),
|
16 |
title="Text Summarizer",
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
summarized_text = summarizer(input_text, max_length=128, min_length=64, do_sample=False , wait_for_model = True)
|
10 |
return summarized_text[0]['summary_text']
|
11 |
|
12 |
+
def summarize_with_button(text):
|
13 |
+
if text == "":
|
14 |
+
return "Please enter some text to summarize."
|
15 |
+
else:
|
16 |
+
return summarize_text(text)
|
17 |
+
|
18 |
+
iface = gr.Interface(
|
19 |
+
fn=summarize_with_button,
|
20 |
inputs=gr.inputs.Textbox(label="Enter the text to summarize"),
|
21 |
outputs=gr.outputs.Textbox(label="Summarized Text"),
|
22 |
title="Text Summarizer",
|
23 |
+
live=True # Enable live updates without a "Summarize" button
|
24 |
+
)
|
25 |
+
|
26 |
+
# Add the "Summarize" button
|
27 |
+
iface.inputs.append(gr.inputs.Button(label="Summarize"))
|
28 |
+
|
29 |
+
iface.launch()
|