File size: 1,819 Bytes
49c39ca
952a6aa
 
 
 
49c39ca
 
952a6aa
 
 
49c39ca
 
 
952a6aa
49c39ca
 
952a6aa
49c39ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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()