Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from transformers import pipeline | |
| # Initialize the BART summarization model from Hugging Face | |
| summarizer = pipeline("summarization", model="facebook/bart-large-cnn") | |
| # Define the function that will summarize the text | |
| def summarize_text(input_text): | |
| summary = summarizer(input_text, max_length=150, min_length=50, do_sample=False) | |
| return summary[0]['summary_text'] | |
| # Create a Gradio interface | |
| iface = gr.Interface(fn=summarize_text, | |
| inputs="text", | |
| outputs="text", | |
| title="Text Summarization App", | |
| description="This app summarizes long-form text (articles, papers, books) into concise key points or a paragraph.", | |
| examples=[["Enter your article text here"]]) | |
| # Launch the interface | |
| iface.launch() | |