Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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(
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
with gr.Blocks() as demo:
|
10 |
-
gr.Markdown("## π§ EvoRAG β Retrieval-Augmented Adaptive AI for
|
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 |
-
|
|
|
|
|
|
|
15 |
with gr.Row():
|
16 |
-
|
17 |
-
option2 = gr.Textbox(label="πΈ Option 2", placeholder="No, maintain current allocation.")
|
18 |
|
19 |
with gr.Row():
|
20 |
-
|
21 |
-
|
22 |
|
23 |
-
|
24 |
-
|
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()
|