HemanM commited on
Commit
6f8dc16
Β·
verified Β·
1 Parent(s): e7d2e38

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -23
app.py CHANGED
@@ -1,36 +1,26 @@
1
  import gradio as gr
2
  from inference import get_evo_response, get_gpt_response
3
- from logger import log_feedback
4
- from utils import extract_text_from_file
5
 
6
- def advisor_interface(question, file, feedback_choice):
7
- context = extract_text_from_file(file) if file else ""
8
-
9
- evo_answer = get_evo_response(question, context)
10
- gpt_answer = get_gpt_response(question, context)
11
-
12
- if feedback_choice != "No feedback":
13
- log_feedback(question, context, evo_answer, feedback_choice)
14
-
15
- return evo_answer, gpt_answer
16
 
17
  with gr.Blocks() as demo:
18
- gr.Markdown("## 🧠 EvoRAG – Retrieval-Augmented Adaptive AI")
 
19
 
20
  with gr.Row():
21
- question = gr.Textbox(label="πŸ“ Ask anything", placeholder="e.g. Should we diversify the portfolio?")
22
-
23
- with gr.Row():
24
- file = gr.File(label="πŸ“‚ Upload memo (.pdf or .txt)", file_types=[".pdf", ".txt"], type="binary")
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=[question, file, feedback], outputs=[evo_out, gpt_out])
35
 
36
  demo.launch()
 
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()