Rajiv Shah
first push
b023ffe
raw
history blame
1.56 kB
import gradio as gr
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
title = "Forward Looking Statement Classification with FinBERT"
description = "This model classifies a sentence into one of the three categories: Specific FLS, Non- Specific FLS, and Not-FLS. We label a sentence as Specific FLS if it is about the future of the company, as Non-Specific FLS if it is future-oriented but could be said of any company (e.g., cautionary language or risk disclosure), and as Not-FLS if it is not about the future."
examples =[['we expect the age of our fleet to enhance availability and reliability due to reduced downtime for repairs.'],
['on an equivalent unit of production basis, general and administrative expenses declined 24 percent from 1994 to $.67 per boe.'],
['we will continue to assess the need for a valuation allowance against deferred tax assets considering all available evidence obtained in future reporting periods.']]
tokenizer = AutoTokenizer.from_pretrained("yiyanghkust/finbert-fls")
finbert = AutoModelForSequenceClassification.from_pretrained("yiyanghkust/finbert-fls")
nlp = pipeline("text-classification", model=finbert, tokenizer=tokenizer)
def get_sentiment(input_text):
return nlp(input_text)
iface = gr.Interface(fn=get_sentiment,
inputs="text",
outputs=["text"],
title=title,
description=description,
examples=examples)
iface.launch(debug=True)