Spaces:
Sleeping
Sleeping
File size: 690 Bytes
f1e1169 4b27157 f1e1169 f07cb54 4b27157 ceefbce 4b27157 ceefbce |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# 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() |