Spaces:
Sleeping
Sleeping
File size: 626 Bytes
8d00d40 7271103 3afb68f 8d00d40 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import gradio as gr
from transformers import pipeline
# Load the summarization model from Hugging Face
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
# Function to perform text summarization
def summarize_text(article):
summary = summarizer(article, max_length=130, min_length=30, do_sample=False)
return summary[0]['summary_text']
# Create the Gradio interface
iface = gr.Interface(
fn=summarize_text,
inputs=gr.TextArea( placeholder="Enter your article here..."),
outputs=gr.Textbox( placeholder="Summary will appear here...")
)
if __name__ == "__main__":
iface.launch()
|