Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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(
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 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 |
-
|
| 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 |
-
|
|
|
|
| 28 |
|
| 29 |
with gr.Row():
|
| 30 |
-
|
| 31 |
-
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
| 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()
|