Spaces:
Runtime error
Runtime error
File size: 994 Bytes
c2cbc53 5235ed9 8142bba f0d20e1 2e88510 c437916 9fa6305 9cb9795 0d1fa55 a80dbe8 cbf1d0c 83ead12 a425649 0d1fa55 013e3d8 a4be657 8142bba |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import gradio as gr
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
tokenizer = AutoTokenizer.from_pretrained("human-centered-summarization/financial-summarization-pegasus")
model = AutoModelForSeq2SeqLM.from_pretrained("human-centered-summarization/financial-summarization-pegasus")
pipe = pipeline(task="text2text-generation", model=model, tokenizer=tokenizer)
with open('text1.txt') as f:
text1 = f.read()
with open('text2.txt') as f:
text2 = f.read()
with open('text3.txt') as f:
text3 = f.read()
gr.Interface.from_pipeline(pipe,
title="Financial Summarization",
description="Financial Summarization using google/pegasus-xsum fine-tuned on financial news dataset. Model can be found at https://huggingface.co/human-centered-summarization/financial-summarization-pegasus. Examples are news articles from business.inquirer.net.",
examples=[text1,text2,text3]
).launch() |