Spaces:
Sleeping
Sleeping
Update rag/ui.py
Browse files
rag/ui.py
CHANGED
|
@@ -1,21 +1,37 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
|
|
|
| 3 |
def build_demo(retrieve_and_answer):
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
with gr.Row():
|
| 9 |
query_input = gr.Textbox(
|
| 10 |
-
label="Question",
|
| 11 |
-
placeholder=
|
|
|
|
|
|
|
|
|
|
| 12 |
)
|
| 13 |
-
submit_btn = gr.Button("
|
| 14 |
|
| 15 |
with gr.Row():
|
| 16 |
-
output_gallery = gr.Gallery(
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
submit_btn.click(
|
| 21 |
retrieve_and_answer,
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
|
| 4 |
def build_demo(retrieve_and_answer):
|
| 5 |
+
"""
|
| 6 |
+
Build the Gradio interface for the Financial RAG demo.
|
| 7 |
+
|
| 8 |
+
The UI is intentionally minimal and technical, focusing on
|
| 9 |
+
transparency of sources and system behavior rather than aesthetics.
|
| 10 |
+
"""
|
| 11 |
+
with gr.Blocks(title="Financial RAG Demo") as demo:
|
| 12 |
+
gr.Markdown("# Financial RAG Demo")
|
| 13 |
+
gr.Markdown(
|
| 14 |
+
"Architecture: GLiNER (CPU Router) → GTE-7B (Retrieval) → Qwen2-VL (Vision Analysis)"
|
| 15 |
+
)
|
| 16 |
|
| 17 |
with gr.Row():
|
| 18 |
query_input = gr.Textbox(
|
| 19 |
+
label="User Question",
|
| 20 |
+
placeholder=(
|
| 21 |
+
"Example: Compare Apple and Microsoft revenue, "
|
| 22 |
+
"or ask about a specific company metric."
|
| 23 |
+
),
|
| 24 |
)
|
| 25 |
+
submit_btn = gr.Button("Run Analysis", variant="primary")
|
| 26 |
|
| 27 |
with gr.Row():
|
| 28 |
+
output_gallery = gr.Gallery(
|
| 29 |
+
label="Source Documents",
|
| 30 |
+
columns=3,
|
| 31 |
+
height=300,
|
| 32 |
+
)
|
| 33 |
+
output_meta = gr.Markdown(label="System Trace")
|
| 34 |
+
output_text = gr.Markdown(label="Answer")
|
| 35 |
|
| 36 |
submit_btn.click(
|
| 37 |
retrieve_and_answer,
|