keep trying
Browse files
app.py
CHANGED
@@ -22,9 +22,8 @@ def summarize_text(text):
|
|
22 |
return stext
|
23 |
|
24 |
##Fiscal Sentiment
|
25 |
-
|
26 |
-
|
27 |
-
fin_model = pipeline("text-classification", model=audit_model, tokenizer=tokenizer)
|
28 |
def text_to_sentiment(text):
|
29 |
sentiment = fin_model(text)[0]["label"]
|
30 |
return sentiment
|
@@ -32,15 +31,13 @@ def text_to_sentiment(text):
|
|
32 |
##Company Extraction
|
33 |
def fin_ner(text):
|
34 |
print ("ner")
|
35 |
-
|
36 |
-
model = AutoModelForTokenClassification.from_pretrained("dslim/bert-base-NER")
|
37 |
-
ner_pipeline = pipeline("ner", model=model, tokenizer=tokenizer)
|
38 |
#api = gr.Interface.load("dslim/bert-base-NER", src='models')
|
39 |
-
|
40 |
-
print (
|
41 |
print ("spans2")
|
42 |
#replaced_spans = [(key, None) if value=='No Disease' else (key, value) for (key, value) in spans]
|
43 |
-
return
|
44 |
|
45 |
##Fiscal Sentiment by Sentence
|
46 |
def fin_ext(text):
|
@@ -76,7 +73,7 @@ with demo:
|
|
76 |
|
77 |
b4 = gr.Button("Extract Companies & Segments")
|
78 |
replaced_spans = gr.HighlightedText()
|
79 |
-
b4.click(fin_ner, inputs=text, outputs=
|
80 |
|
81 |
b5 = gr.Button("Extract Financial Sentiment")
|
82 |
fin_spans = gr.HighlightedText()
|
|
|
22 |
return stext
|
23 |
|
24 |
##Fiscal Sentiment
|
25 |
+
fin_model = pipeline("text-classification", model="demo-org/auditor_review_model", \
|
26 |
+
tokenizer="demo-org/auditor_review_model",use_auth_token=auth_token)
|
|
|
27 |
def text_to_sentiment(text):
|
28 |
sentiment = fin_model(text)[0]["label"]
|
29 |
return sentiment
|
|
|
31 |
##Company Extraction
|
32 |
def fin_ner(text):
|
33 |
print ("ner")
|
34 |
+
ner_pipeline = pipeline("ner", model="dslim/bert-base-NER", tokenizer="dslim/bert-base-NER")
|
|
|
|
|
35 |
#api = gr.Interface.load("dslim/bert-base-NER", src='models')
|
36 |
+
replaced_spans = ner_pipeline(text)
|
37 |
+
print (replaced_spans)
|
38 |
print ("spans2")
|
39 |
#replaced_spans = [(key, None) if value=='No Disease' else (key, value) for (key, value) in spans]
|
40 |
+
return replaced_spans
|
41 |
|
42 |
##Fiscal Sentiment by Sentence
|
43 |
def fin_ext(text):
|
|
|
73 |
|
74 |
b4 = gr.Button("Extract Companies & Segments")
|
75 |
replaced_spans = gr.HighlightedText()
|
76 |
+
b4.click(fin_ner, inputs=text, outputs=replaced_spans)
|
77 |
|
78 |
b5 = gr.Button("Extract Financial Sentiment")
|
79 |
fin_spans = gr.HighlightedText()
|