Spaces:
Build error
Build error
clarifying function names
Browse files
app.py
CHANGED
|
@@ -30,7 +30,7 @@ def text_to_sentiment(text):
|
|
| 30 |
return sentiment
|
| 31 |
|
| 32 |
##Company Extraction
|
| 33 |
-
def
|
| 34 |
tokenizer = AutoTokenizer.from_pretrained("dslim/bert-base-NER")
|
| 35 |
model = AutoModelForTokenClassification.from_pretrained("dslim/bert-base-NER")
|
| 36 |
ner = pipeline("ner", model=model, tokenizer=tokenizer)
|
|
@@ -73,7 +73,7 @@ with demo:
|
|
| 73 |
|
| 74 |
b4 = gr.Button("Extract Companies & Segments")
|
| 75 |
replaced_spans = gr.HighlightedText()
|
| 76 |
-
b4.click(
|
| 77 |
|
| 78 |
b5 = gr.Button("Extract Financial Sentiment")
|
| 79 |
fin_spans = gr.HighlightedText()
|
|
|
|
| 30 |
return sentiment
|
| 31 |
|
| 32 |
##Company Extraction
|
| 33 |
+
def fin_ner(text):
|
| 34 |
tokenizer = AutoTokenizer.from_pretrained("dslim/bert-base-NER")
|
| 35 |
model = AutoModelForTokenClassification.from_pretrained("dslim/bert-base-NER")
|
| 36 |
ner = pipeline("ner", model=model, tokenizer=tokenizer)
|
|
|
|
| 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()
|