Spaces:
Sleeping
Sleeping
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() | |