Spaces:
Build error
Build error
Added title
Browse files
app.py
CHANGED
|
@@ -2,7 +2,6 @@ import os
|
|
| 2 |
os.system("pip install gradio==3.0.18")
|
| 3 |
from transformers import pipeline, AutoTokenizer, AutoModelForSequenceClassification, AutoModelForTokenClassification
|
| 4 |
import gradio as gr
|
| 5 |
-
|
| 6 |
import spacy
|
| 7 |
nlp = spacy.load('en_core_web_sm')
|
| 8 |
|
|
@@ -23,8 +22,6 @@ def summarize_text(text):
|
|
| 23 |
return stext
|
| 24 |
|
| 25 |
##Fiscal Tone Analysis
|
| 26 |
-
#fin_model = pipeline("text-classification", model="demo-org/auditor_review_model",
|
| 27 |
-
# tokenizer="demo-org/auditor_review_model",use_auth_token=auth_token)
|
| 28 |
fin_model= pipeline("sentiment-analysis", model='yiyanghkust/finbert-tone', tokenizer='yiyanghkust/finbert-tone')
|
| 29 |
def text_to_sentiment(text):
|
| 30 |
sentiment = fin_model(text)[0]["label"]
|
|
@@ -32,7 +29,7 @@ def text_to_sentiment(text):
|
|
| 32 |
|
| 33 |
##Company Extraction
|
| 34 |
def fin_ner(text):
|
| 35 |
-
api = gr.Interface.load("dslim/bert-base-NER", src='models')
|
| 36 |
replaced_spans = api(text)
|
| 37 |
return replaced_spans
|
| 38 |
|
|
@@ -70,6 +67,8 @@ def fls(text):
|
|
| 70 |
demo = gr.Blocks()
|
| 71 |
|
| 72 |
with demo:
|
|
|
|
|
|
|
| 73 |
with gr.Row():
|
| 74 |
with gr.Column():
|
| 75 |
audio_file = gr.inputs.Audio(source="microphone", type="filepath")
|
|
|
|
| 2 |
os.system("pip install gradio==3.0.18")
|
| 3 |
from transformers import pipeline, AutoTokenizer, AutoModelForSequenceClassification, AutoModelForTokenClassification
|
| 4 |
import gradio as gr
|
|
|
|
| 5 |
import spacy
|
| 6 |
nlp = spacy.load('en_core_web_sm')
|
| 7 |
|
|
|
|
| 22 |
return stext
|
| 23 |
|
| 24 |
##Fiscal Tone Analysis
|
|
|
|
|
|
|
| 25 |
fin_model= pipeline("sentiment-analysis", model='yiyanghkust/finbert-tone', tokenizer='yiyanghkust/finbert-tone')
|
| 26 |
def text_to_sentiment(text):
|
| 27 |
sentiment = fin_model(text)[0]["label"]
|
|
|
|
| 29 |
|
| 30 |
##Company Extraction
|
| 31 |
def fin_ner(text):
|
| 32 |
+
api = gr.Interface.load("dslim/bert-base-NER", src='models',use_auth_token=auth_token)
|
| 33 |
replaced_spans = api(text)
|
| 34 |
return replaced_spans
|
| 35 |
|
|
|
|
| 67 |
demo = gr.Blocks()
|
| 68 |
|
| 69 |
with demo:
|
| 70 |
+
gr.Markdown("## Analyst AI")
|
| 71 |
+
gr.Markdown("This project applies AI trained by our financial analysts to analyze earning calls and other financial documents.")
|
| 72 |
with gr.Row():
|
| 73 |
with gr.Column():
|
| 74 |
audio_file = gr.inputs.Audio(source="microphone", type="filepath")
|