HemanM commited on
Commit
676eb03
Β·
verified Β·
1 Parent(s): fbd71f6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -14
app.py CHANGED
@@ -1,26 +1,36 @@
1
  import gradio as gr
2
- from inference import get_evo_response, get_gpt_response
 
3
 
4
- def advisor_interface(prompt, option1, option2):
5
- evo_result = get_evo_response(prompt, option1, option2)
6
- gpt_result = get_gpt_response(prompt, option1, option2)
7
- return evo_result, gpt_result
 
 
 
 
 
 
 
 
8
 
9
  with gr.Blocks() as demo:
10
- gr.Markdown("## 🧠 EvoRAG – Retrieval-Augmented Adaptive AI for Reasoning")
11
- gr.Markdown("Ask a commonsense or financial reasoning question with two options. Evo and GPT-3.5 will both suggest the better one.")
12
 
13
  with gr.Row():
14
- prompt = gr.Textbox(label="πŸ“ Your Question", placeholder="e.g. Should we reduce exposure to Tech Fund A this quarter?")
 
 
 
15
  with gr.Row():
16
- option1 = gr.Textbox(label="πŸ”Ή Option 1", placeholder="Yes, reduce exposure this quarter.")
17
- option2 = gr.Textbox(label="πŸ”Έ Option 2", placeholder="No, maintain current allocation.")
18
 
19
  with gr.Row():
20
- evo_output = gr.Textbox(label="πŸ”¬ EvoRAG Suggestion")
21
- gpt_output = gr.Textbox(label="πŸ€– GPT-3.5 Suggestion")
22
 
23
- run_btn = gr.Button("Run Advisors")
24
- run_btn.click(fn=advisor_interface, inputs=[prompt, option1, option2], outputs=[evo_output, gpt_output])
25
 
26
  demo.launch()
 
1
  import gradio as gr
2
+ from inference import get_evo_response, get_gpt_response, get_context_from_file
3
+ from logger import log_feedback
4
 
5
+ def advisor_interface(query, file, feedback_choice):
6
+ context = None
7
+ if file is not None:
8
+ context = get_context_from_file(file)
9
+
10
+ evo_output = get_evo_response(query, file)
11
+ gpt_output = get_gpt_response(query, file)
12
+
13
+ if feedback_choice != "No feedback":
14
+ log_feedback(query, context, evo_output, feedback_choice)
15
+
16
+ return evo_output, gpt_output
17
 
18
  with gr.Blocks() as demo:
19
+ gr.Markdown("## 🧠 EvoRAG – Retrieval-Augmented Adaptive AI for Finance")
 
20
 
21
  with gr.Row():
22
+ query = gr.Textbox(label="πŸ“ Ask a financial question", placeholder="e.g. Should we reduce exposure to Fund A?")
23
+
24
+ file = gr.File(label="πŸ“‚ Upload policy or memo (.pdf or .txt)", type="file")
25
+
26
  with gr.Row():
27
+ feedback = gr.Radio(["πŸ‘ Helpful", "πŸ‘Ž Not Helpful", "No feedback"], label="Was Evo’s answer useful?", value="No feedback")
 
28
 
29
  with gr.Row():
30
+ evo_out = gr.Textbox(label="πŸ”¬ EvoRAG Suggestion")
31
+ gpt_out = gr.Textbox(label="πŸ€– GPT-3.5 Suggestion")
32
 
33
+ submit_btn = gr.Button("Run Advisors")
34
+ submit_btn.click(fn=advisor_interface, inputs=[query, file, feedback], outputs=[evo_out, gpt_out])
35
 
36
  demo.launch()