Spaces:
Runtime error
Runtime error
adityasrathore
commited on
Commit
•
11fe4f6
1
Parent(s):
81adca3
Update app.py
Browse files
app.py
CHANGED
@@ -60,45 +60,39 @@ def fls(text):
|
|
60 |
results = fls_model(split_in_sentences(text))
|
61 |
return make_spans(text,results)
|
62 |
|
63 |
-
demo = gr.
|
64 |
|
65 |
with demo:
|
66 |
gr.Markdown("## Financial Analyst AI")
|
67 |
gr.Markdown("This project applies AI trained by our financial analysts to analyze earning calls and other financial documents.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
|
69 |
-
# Row 1: Speech Recognition and Text Summarization
|
70 |
-
with gr.Row():
|
71 |
-
with gr.Column():
|
72 |
-
audio_file = gr.inputs.Audio(source="microphone", type="filepath")
|
73 |
-
b1 = gr.Button("Recognize Speech")
|
74 |
-
text = gr.Textbox(value="") # Textbox for speech-to-text output
|
75 |
-
|
76 |
-
with gr.Column():
|
77 |
-
b2 = gr.Button("Summarize Text")
|
78 |
-
stext = gr.Textbox() # Textbox for summarized text output
|
79 |
-
|
80 |
-
# Row 2: Financial Tone Analysis
|
81 |
-
with gr.Row():
|
82 |
-
b3 = gr.Button("Classify Financial Tone")
|
83 |
-
label = gr.Label() # Label for sentiment analysis output
|
84 |
-
|
85 |
-
# Row 3: Financial Tone and Forward Looking Statement Analysis
|
86 |
-
with gr.Row():
|
87 |
-
b5 = gr.Button("Financial Tone and Forward Looking Statement Analysis")
|
88 |
-
fin_spans = gr.HighlightedText() # HighlightedText for financial sentiment spans
|
89 |
-
fls_spans = gr.HighlightedText() # HighlightedText for forward looking statement spans
|
90 |
-
|
91 |
-
# Row 4: Identify Companies & Locations
|
92 |
-
with gr.Row():
|
93 |
-
b4 = gr.Button("Identify Companies & Locations")
|
94 |
-
replaced_spans = gr.HighlightedText() # HighlightedText for named entity recognition spans
|
95 |
-
|
96 |
-
# Define the click handlers for the buttons
|
97 |
-
b1.click(speech_to_text, inputs=audio_file, outputs=text)
|
98 |
-
b2.click(summarize_text, inputs=text, outputs=stext)
|
99 |
-
b3.click(text_to_sentiment, inputs=stext, outputs=label)
|
100 |
-
b5.click(fin_ext, inputs=text, outputs=fin_spans)
|
101 |
-
b5.click(fls, inputs=text, outputs=fls_spans)
|
102 |
-
b4.click(fin_ner, inputs=text, outputs=replaced_spans)
|
103 |
-
|
104 |
demo.launch()
|
|
|
60 |
results = fls_model(split_in_sentences(text))
|
61 |
return make_spans(text,results)
|
62 |
|
63 |
+
demo = gr.Blocks()
|
64 |
|
65 |
with demo:
|
66 |
gr.Markdown("## Financial Analyst AI")
|
67 |
gr.Markdown("This project applies AI trained by our financial analysts to analyze earning calls and other financial documents.")
|
68 |
+
with gr.Column(): # Main Column
|
69 |
+
with gr.Row():
|
70 |
+
with gr.Column(): # Left Column
|
71 |
+
audio_file = gr.inputs.Audio(source="microphone", type="filepath")
|
72 |
+
b1 = gr.Button("Recognize Speech")
|
73 |
+
text = gr.Textbox(value="") # Move this outside the row
|
74 |
+
b2 = gr.Button("Summarize Text")
|
75 |
+
stext = gr.Textbox()
|
76 |
+
b3 = gr.Button("Classify Financial Tone")
|
77 |
+
label = gr.Label()
|
78 |
+
|
79 |
+
# Reorganize the layout of the buttons and inputs
|
80 |
+
b1.click(speech_to_text, inputs=audio_file, outputs=text)
|
81 |
+
b2.click(summarize_text, inputs=text, outputs=stext)
|
82 |
+
b3.click(text_to_sentiment, inputs=stext, outputs=label)
|
83 |
+
|
84 |
+
with gr.Column(): # Right Column
|
85 |
+
b5 = gr.Button("Financial Tone and Forward Looking Statement Analysis")
|
86 |
+
fin_spans = gr.HighlightedText()
|
87 |
+
fls_spans = gr.HighlightedText()
|
88 |
+
b5.click(fin_ext, inputs=text, outputs=fin_spans)
|
89 |
+
b5.click(fls, inputs=text, outputs=fls_spans)
|
90 |
+
|
91 |
+
b4 = gr.Button("Identify Companies & Locations")
|
92 |
+
replaced_spans = gr.HighlightedText()
|
93 |
+
b4.click(fin_ner, inputs=text, outputs=replaced_spans)
|
94 |
+
|
95 |
+
# Place the textbox here, so it's separate from the buttons and inputs
|
96 |
+
text = gr.Textbox(value="")
|
97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
demo.launch()
|