Rajiv Shah commited on
Commit
b023ffe
1 Parent(s): ef9bae2

first push

Browse files
Files changed (2) hide show
  1. app.py +25 -0
  2. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
3
+
4
+ title = "Forward Looking Statement Classification with FinBERT"
5
+ 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."
6
+ examples =[['we expect the age of our fleet to enhance availability and reliability due to reduced downtime for repairs.'],
7
+ ['on an equivalent unit of production basis, general and administrative expenses declined 24 percent from 1994 to $.67 per boe.'],
8
+ ['we will continue to assess the need for a valuation allowance against deferred tax assets considering all available evidence obtained in future reporting periods.']]
9
+
10
+ tokenizer = AutoTokenizer.from_pretrained("yiyanghkust/finbert-fls")
11
+ finbert = AutoModelForSequenceClassification.from_pretrained("yiyanghkust/finbert-fls")
12
+ nlp = pipeline("text-classification", model=finbert, tokenizer=tokenizer)
13
+
14
+ def get_sentiment(input_text):
15
+ return nlp(input_text)
16
+
17
+ iface = gr.Interface(fn=get_sentiment,
18
+ inputs="text",
19
+ outputs=["text"],
20
+ title=title,
21
+ description=description,
22
+ examples=examples)
23
+ iface.launch(debug=True)
24
+
25
+
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
1
+ gradio
2
+ transformers