updated code function refactor
Browse files
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(
|
65 |
-
|
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 |
|