Spaces:
Runtime error
Runtime error
File size: 602 Bytes
26628e2 fbddca2 697b008 fbddca2 e5f9d0d 26628e2 fbddca2 11d5370 fbddca2 848f38c fbddca2 |
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
# Step 3: Define the summarization function
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
def summarize(text):
summary = summarizer(text, max_length=150, min_length=40, do_sample=False)
return summary[0]['summary_text']
# Step 4: Create the Gradio interface
iface = gr.Interface(
fn=summarize,
inputs="textbox",
outputs="textbox",
title="Text Summarizer",
description="Summarize text using the facebook/bart-large-cnn model from Hugging Face"
)
# Step 5: Launch the interface
iface.launch() |