Spaces:
Sleeping
Sleeping
File size: 629 Bytes
822f3ae 0a6da1c 2cce74e 822f3ae 0a6da1c 775ea34 0a6da1c 7d51c2e 0a6da1c 775ea34 2cce74e 822f3ae 775ea34 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import gradio as gr
import torch
from transformers import pipeline
summarizer = pipeline("summarization", "jordiclive/flan-t5-3b-summarizer", torch_dtype=torch.bfloat16)
raw_document = 'You must be 18 years old to live or work in New York State...'
prompt = "Produce an article summary of the following news article:"
def summarize(input):
output = summarizer(
f"{prompt} {input}",
num_beams=5,
min_length=5,
no_repeat_ngram_size=3,
truncation=True,
max_length=512,
)
return output
demo = gr.Interface(fn=summarize, inputs="text", outputs="text")
demo.launch()
|