Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from transformers import pipeline | |
| # Initialize the summarization pipeline | |
| summarizer = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6") | |
| # Define the summarization function | |
| def summarize(text): | |
| summary = summarizer(text, max_length=130, min_length=30, do_sample=False) | |
| return summary[0]['summary_text'] | |
| # Create the Gradio interface | |
| interface = gr.Interface(fn=summarize, inputs="text", outputs="text", title="Text Summarizer") | |
| # Launch the application | |
| interface.launch() | |