File size: 1,255 Bytes
6a94f97
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
from inference import get_evo_response, get_gpt_response
from logger import log_feedback

def advisor_interface(query, context, feedback_choice):
    evo_output = get_evo_response(query, context)
    gpt_output = get_gpt_response(query, context)

    if feedback_choice != "No feedback":
        log_feedback(query, context, evo_output, feedback_choice)

    return evo_output, gpt_output

with gr.Blocks() as demo:
    gr.Markdown("## 🧠 EvoAdvisor – Your Adaptive AI Copilot for Finance")

    with gr.Row():
        query = gr.Textbox(label="πŸ“ Ask a financial question", placeholder="e.g. Should we exit this position?")
        context = gr.Textbox(label="πŸ“‚ Related memo or policy context", placeholder="Paste internal strategy or notes here...")

    with gr.Row():
        feedback = gr.Radio(["πŸ‘ Helpful", "πŸ‘Ž Not Helpful", "No feedback"], label="Was Evo’s answer useful?", value="No feedback")

    with gr.Row():
        evo_out = gr.Textbox(label="πŸ”¬ EvoAdvisor's Suggestion")
        gpt_out = gr.Textbox(label="πŸ€– GPT-3.5's Suggestion")

    submit_btn = gr.Button("Run Advisors")
    submit_btn.click(fn=advisor_interface, inputs=[query, context, feedback], outputs=[evo_out, gpt_out])

demo.launch()