Spaces:
No application file
No application file
Create app.y
Browse files
app.y
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
5 |
+
|
6 |
+
def summarize_text(text):
|
7 |
+
summary = summarizer(text, max_length=130, min_length=30, do_sample=False)
|
8 |
+
return summary[0]['summary_text']
|
9 |
+
|
10 |
+
iface = gr.Interface(
|
11 |
+
fn=summarize_text,
|
12 |
+
inputs=gr.Textbox(lines=10, label="Enter text to summarize"),
|
13 |
+
outputs=gr.Textbox(label="Summarized text"),
|
14 |
+
title="Summariser",
|
15 |
+
description="Enter text to get a concise summary."
|
16 |
+
)
|
17 |
+
|
18 |
+
iface.launch()
|