Spaces:
Running on Zero
Running on Zero
Layout: 2-column split (left=data+question, right=results)
Browse files
app.py
CHANGED
|
@@ -91,9 +91,31 @@ gradio-app, .gradio-container, .main, .app, .contain, .wrap {
|
|
| 91 |
font-family: var(--font) !important;
|
| 92 |
}
|
| 93 |
.gradio-container {
|
| 94 |
-
max-width:
|
| 95 |
margin: 0 auto !important;
|
| 96 |
-
padding: 36px
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
}
|
| 98 |
footer { display: none !important; }
|
| 99 |
.show-api { display: none !important; }
|
|
@@ -836,41 +858,44 @@ def build_app() -> gr.Blocks:
|
|
| 836 |
'</div>'
|
| 837 |
)
|
| 838 |
|
| 839 |
-
#
|
| 840 |
-
with gr.Row(elem_classes=["
|
| 841 |
-
|
| 842 |
-
|
| 843 |
-
|
| 844 |
-
|
| 845 |
-
|
| 846 |
-
|
| 847 |
-
|
| 848 |
-
|
| 849 |
-
|
| 850 |
-
|
| 851 |
-
|
| 852 |
-
|
| 853 |
-
|
| 854 |
-
|
| 855 |
-
|
| 856 |
-
|
| 857 |
-
|
| 858 |
-
|
| 859 |
-
|
| 860 |
-
|
| 861 |
-
|
| 862 |
-
|
| 863 |
-
|
| 864 |
-
|
| 865 |
-
|
| 866 |
-
|
| 867 |
-
|
| 868 |
-
|
| 869 |
-
|
| 870 |
-
|
| 871 |
-
|
| 872 |
-
|
| 873 |
-
|
|
|
|
|
|
|
|
|
|
| 874 |
|
| 875 |
# ------------- events -------------
|
| 876 |
upload.upload(
|
|
|
|
| 91 |
font-family: var(--font) !important;
|
| 92 |
}
|
| 93 |
.gradio-container {
|
| 94 |
+
max-width: 1280px !important;
|
| 95 |
margin: 0 auto !important;
|
| 96 |
+
padding: 36px 32px 100px !important;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
/* Two-column rectangular layout */
|
| 100 |
+
.split-layout {
|
| 101 |
+
display: grid;
|
| 102 |
+
grid-template-columns: minmax(320px, 420px) 1fr;
|
| 103 |
+
gap: 32px;
|
| 104 |
+
align-items: start;
|
| 105 |
+
}
|
| 106 |
+
@media (max-width: 860px) {
|
| 107 |
+
.split-layout { grid-template-columns: 1fr; gap: 20px; }
|
| 108 |
+
}
|
| 109 |
+
.split-left { position: sticky; top: 24px; }
|
| 110 |
+
.split-right { min-height: 400px; }
|
| 111 |
+
|
| 112 |
+
.panel-label {
|
| 113 |
+
font-size: 11px;
|
| 114 |
+
font-weight: 600;
|
| 115 |
+
text-transform: uppercase;
|
| 116 |
+
letter-spacing: 0.06em;
|
| 117 |
+
color: var(--ink-muted) !important;
|
| 118 |
+
margin: 0 0 10px 2px;
|
| 119 |
}
|
| 120 |
footer { display: none !important; }
|
| 121 |
.show-api { display: none !important; }
|
|
|
|
| 858 |
'</div>'
|
| 859 |
)
|
| 860 |
|
| 861 |
+
# Two-column layout: LEFT = data/question controls, RIGHT = results
|
| 862 |
+
with gr.Row(elem_classes=["split-layout"]):
|
| 863 |
+
# ---------- LEFT panel ----------
|
| 864 |
+
with gr.Column(elem_classes=["split-left"], scale=0):
|
| 865 |
+
gr.HTML('<div class="panel-label">Dataset</div>')
|
| 866 |
+
with gr.Row(elem_classes=["upload-row"]):
|
| 867 |
+
upload = gr.File(
|
| 868 |
+
label="",
|
| 869 |
+
file_types=[".csv", ".json", ".parquet", ".xlsx", ".xls"],
|
| 870 |
+
show_label=False,
|
| 871 |
+
container=False,
|
| 872 |
+
)
|
| 873 |
+
chip_html = gr.HTML("")
|
| 874 |
+
schema_html = gr.HTML("")
|
| 875 |
+
|
| 876 |
+
gr.HTML('<div class="panel-label" style="margin-top:18px">Question</div>')
|
| 877 |
+
with gr.Group(elem_classes=["question-row"]):
|
| 878 |
+
question = gr.Textbox(
|
| 879 |
+
placeholder="Ask anything about your data…",
|
| 880 |
+
lines=3,
|
| 881 |
+
max_lines=10,
|
| 882 |
+
show_label=False,
|
| 883 |
+
container=False,
|
| 884 |
+
autofocus=True,
|
| 885 |
+
)
|
| 886 |
+
gr.HTML('<div class="kb-hint">Press Enter to send · Shift+Enter for newline</div>')
|
| 887 |
+
|
| 888 |
+
with gr.Row():
|
| 889 |
+
ask_btn = gr.Button("Ask", variant="primary", size="sm")
|
| 890 |
+
reset_btn = gr.Button("Clear", variant="secondary", size="sm")
|
| 891 |
+
demo_btn = gr.Button("Demo", variant="secondary", size="sm",
|
| 892 |
+
elem_id="load_demo_btn")
|
| 893 |
+
|
| 894 |
+
# ---------- RIGHT panel ----------
|
| 895 |
+
with gr.Column(elem_classes=["split-right"], scale=1):
|
| 896 |
+
gr.HTML('<div class="panel-label">Result</div>')
|
| 897 |
+
history_state = gr.State([])
|
| 898 |
+
conversation = gr.HTML(_conversation_html([]))
|
| 899 |
|
| 900 |
# ------------- events -------------
|
| 901 |
upload.upload(
|