rajistics commited on
Commit
6e426e5
1 Parent(s): 54d9bd0

updated code function refactor

Browse files
Files changed (1) hide show
  1. app.py +2 -12
app.py CHANGED
@@ -55,19 +55,9 @@ def fin_ext(text):
55
 
56
  ##Forward Looking Statement
57
  def fls(text):
58
- doc = nlp(text)
59
- doc_sents = [sent for sent in doc.sents]
60
- sents_list = []
61
- for sent in doc.sents:
62
- sents_list.append(sent.text)
63
  fls_model = pipeline("text-classification", model="yiyanghkust/finbert-fls", tokenizer="yiyanghkust/finbert-fls")
64
- results = fls_model(sents_list)
65
- results_list = []
66
- for i in range(len(results)):
67
- results_list.append(results[i]['label'])
68
- fls_spans = []
69
- fls_spans = list(zip(sents_list,results_list))
70
- return fls_spans
71
 
72
  demo = gr.Blocks()
73
 
 
55
 
56
  ##Forward Looking Statement
57
  def fls(text):
 
 
 
 
 
58
  fls_model = pipeline("text-classification", model="yiyanghkust/finbert-fls", tokenizer="yiyanghkust/finbert-fls")
59
+ results = fls_model(split_in_sentences(text))
60
+ return make_spans(text,results)
 
 
 
 
 
61
 
62
  demo = gr.Blocks()
63