Spaces:
Sleeping
Sleeping
| from transformers import pipeline | |
| import gradio as gr | |
| # Load summarization pipeline | |
| summarizer = pipeline("summarization", model="facebook/bart-large-cnn") | |
| # Function for summarization | |
| def summarize_text(text): | |
| return summarizer(text, max_length=60, min_length=20, do_sample=False)[0]["summary_text"] | |
| # Gradio interface | |
| iface = gr.Interface( | |
| fn=summarize_text, | |
| inputs="text", | |
| outputs="text", | |
| title="Summarizer LLM" | |
| ) | |
| # Launch app | |
| iface.launch() | |