Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from inference import get_evo_response, get_gpt_response
|
| 3 |
+
from logger import log_feedback
|
| 4 |
+
|
| 5 |
+
def advisor_interface(query, context, feedback_choice):
|
| 6 |
+
evo_output = get_evo_response(query, context)
|
| 7 |
+
gpt_output = get_gpt_response(query, context)
|
| 8 |
+
|
| 9 |
+
if feedback_choice != "No feedback":
|
| 10 |
+
log_feedback(query, context, evo_output, feedback_choice)
|
| 11 |
+
|
| 12 |
+
return evo_output, gpt_output
|
| 13 |
+
|
| 14 |
+
with gr.Blocks() as demo:
|
| 15 |
+
gr.Markdown("## 🧠 EvoAdvisor – Your Adaptive AI Copilot for Finance")
|
| 16 |
+
|
| 17 |
+
with gr.Row():
|
| 18 |
+
query = gr.Textbox(label="📝 Ask a financial question", placeholder="e.g. Should we exit this position?")
|
| 19 |
+
context = gr.Textbox(label="📂 Related memo or policy context", placeholder="Paste internal strategy or notes here...")
|
| 20 |
+
|
| 21 |
+
with gr.Row():
|
| 22 |
+
feedback = gr.Radio(["👍 Helpful", "👎 Not Helpful", "No feedback"], label="Was Evo’s answer useful?", value="No feedback")
|
| 23 |
+
|
| 24 |
+
with gr.Row():
|
| 25 |
+
evo_out = gr.Textbox(label="🔬 EvoAdvisor's Suggestion")
|
| 26 |
+
gpt_out = gr.Textbox(label="🤖 GPT-3.5's Suggestion")
|
| 27 |
+
|
| 28 |
+
submit_btn = gr.Button("Run Advisors")
|
| 29 |
+
submit_btn.click(fn=advisor_interface, inputs=[query, context, feedback], outputs=[evo_out, gpt_out])
|
| 30 |
+
|
| 31 |
+
demo.launch()
|