Spaces:
Runtime error
Runtime error
demo = gr.Interface() | |
with demo: | |
gr.Markdown("## Financial Analyst AI") | |
gr.Markdown("This project applies AI trained by our financial analysts to analyze earning calls and other financial documents.") | |
# Row 1: Speech Recognition and Text Summarization | |
with gr.Row(): | |
with gr.Column(): | |
audio_file = gr.inputs.Audio(source="microphone", type="filepath") | |
b1 = gr.Button("Recognize Speech") | |
text = gr.Textbox(value="") # Textbox for speech-to-text output | |
with gr.Column(): | |
b2 = gr.Button("Summarize Text") | |
stext = gr.Textbox() # Textbox for summarized text output | |
# Row 2: Financial Tone Analysis | |
with gr.Row(): | |
b3 = gr.Button("Classify Financial Tone") | |
label = gr.Label() # Label for sentiment analysis output | |
# Row 3: Financial Tone and Forward Looking Statement Analysis | |
with gr.Row(): | |
b5 = gr.Button("Financial Tone and Forward Looking Statement Analysis") | |
fin_spans = gr.HighlightedText() # HighlightedText for financial sentiment spans | |
fls_spans = gr.HighlightedText() # HighlightedText for forward looking statement spans | |
# Row 4: Identify Companies & Locations | |
with gr.Row(): | |
b4 = gr.Button("Identify Companies & Locations") | |
replaced_spans = gr.HighlightedText() # HighlightedText for named entity recognition spans | |
# Define the click handlers for the buttons | |
b1.click(speech_to_text, inputs=audio_file, outputs=text) | |
b2.click(summarize_text, inputs=text, outputs=stext) | |
b3.click(text_to_sentiment, inputs=stext, outputs=label) | |
b5.click(fin_ext, inputs=text, outputs=fin_spans) | |
b5.click(fls, inputs=text, outputs=fls_spans) | |
b4.click(fin_ner, inputs=text, outputs=replaced_spans) | |
demo.launch() | |