MaxGab's picture
Update app.py
027f9e7 verified
raw
history blame contribute delete
396 Bytes
import gradio as gr
from transformers import pipeline
pipe = pipeline("summarization", model="facebook/bart-large-cnn")
def summarize(text):
word_count = len(text.split())
if word_count < 70:
return ("Input a minimum of 70 words.")
elif word_count >= 70:
return pipe(text)
demo = gr.Interface(fn = summarize, inputs="text", outputs="text" )
demo.launch()