File size: 862 Bytes
d20f268
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr

from mars import analyze_ticker


def run_analysis(ticker):
    result = analyze_ticker(ticker)
    return f"""
### Plan
{result['plan']}

### Teacher Question
{result['teacher_question']}

### Critique
{result['critique']}

### Final Question
{result['final_question']}

### Signal
{result['signal']}

### Rationale
{result['rationale']}
"""


with gr.Blocks() as iface:
    gr.Markdown("# MARS Financial Reasoning")
    ticker_input = gr.Textbox(label="Enter stock ticker", placeholder="e.g., TSLA")
    run_button = gr.Button("Analyze", variant="primary")
    output_box = gr.Markdown()

    run_button.click(fn=run_analysis,
                     inputs=ticker_input,
                     outputs=output_box,
                     show_progress=True)  # <-- shows loading and disables button

if __name__ == "__main__":
    iface.launch()