Spaces:
Sleeping
Sleeping
# Load and define summarize function | |
from transformers import pipeline | |
get_completion = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6") | |
def summarize(input): | |
output = get_completion(input) | |
return output[0]['summary_text'] | |
# Gradio Interface | |
import gradio as gr | |
gr.close_all() | |
demo = gr.Interface(fn=summarize, | |
inputs=[gr.Textbox(label="Text", lines=7, placeholder="Enter your text here...")], | |
outputs=[gr.Textbox(label="Result", lines=5)], | |
title="Text Summarizer", | |
description="Summarize text using the `sshleifer/distilbart-cnn-12-6` model.", | |
) | |
demo.launch() |