EvoPlatform / app.py
HemanM's picture
Update app.py
676eb03 verified
raw
history blame
1.32 kB
import gradio as gr
from inference import get_evo_response, get_gpt_response, get_context_from_file
from logger import log_feedback
def advisor_interface(query, file, feedback_choice):
context = None
if file is not None:
context = get_context_from_file(file)
evo_output = get_evo_response(query, file)
gpt_output = get_gpt_response(query, file)
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("## 🧠 EvoRAG – Retrieval-Augmented Adaptive AI for Finance")
with gr.Row():
query = gr.Textbox(label="πŸ“ Ask a financial question", placeholder="e.g. Should we reduce exposure to Fund A?")
file = gr.File(label="πŸ“‚ Upload policy or memo (.pdf or .txt)", type="file")
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="πŸ”¬ EvoRAG Suggestion")
gpt_out = gr.Textbox(label="πŸ€– GPT-3.5 Suggestion")
submit_btn = gr.Button("Run Advisors")
submit_btn.click(fn=advisor_interface, inputs=[query, file, feedback], outputs=[evo_out, gpt_out])
demo.launch()