Spaces:
Sleeping
Sleeping
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,24 +0,0 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
from transformers import pipeline
|
| 3 |
-
|
| 4 |
-
# Load the summarization model
|
| 5 |
-
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
| 6 |
-
|
| 7 |
-
# Define the summarization function
|
| 8 |
-
def summarize_text(text):
|
| 9 |
-
if not text.strip():
|
| 10 |
-
return "Please enter some text to summarize."
|
| 11 |
-
summary = summarizer(text, max_length=130, min_length=30, do_sample=False)
|
| 12 |
-
return summary[0]['summary_text']
|
| 13 |
-
|
| 14 |
-
# Set up the Gradio interface
|
| 15 |
-
iface = gr.Interface(
|
| 16 |
-
fn=summarize_text,
|
| 17 |
-
inputs=gr.Textbox(lines=15, label="Enter text to summarize"),
|
| 18 |
-
outputs=gr.Textbox(label="Summary"),
|
| 19 |
-
title="Text Summarizer",
|
| 20 |
-
description="Paste long text and get a summary using BART model."
|
| 21 |
-
)
|
| 22 |
-
|
| 23 |
-
# Launch the app
|
| 24 |
-
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|