DanielRegaladoCardoso commited on
Commit
a42423c
·
verified ·
1 Parent(s): 5ae5227

Layout: 2-column split (left=data+question, right=results)

Browse files
Files changed (1) hide show
  1. app.py +62 -37
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: 760px !important;
95
  margin: 0 auto !important;
96
- padding: 36px 24px 100px !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
- # Upload
840
- with gr.Row(elem_classes=["upload-row"]):
841
- upload = gr.File(
842
- label="",
843
- file_types=[".csv", ".json", ".parquet", ".xlsx", ".xls"],
844
- show_label=False,
845
- container=False,
846
- )
847
- chip_html = gr.HTML("")
848
-
849
- # Schema preview — sits between dataset and the question, so users
850
- # know the available column names before writing a query.
851
- schema_html = gr.HTML("")
852
-
853
- # Question
854
- with gr.Group(elem_classes=["question-row"]):
855
- question = gr.Textbox(
856
- placeholder="Ask anything about your data…",
857
- lines=2,
858
- max_lines=8,
859
- show_label=False,
860
- container=False,
861
- autofocus=True,
862
- )
863
- gr.HTML('<div class="kb-hint">Press Enter to send · Shift+Enter for newline</div>')
864
-
865
- with gr.Row():
866
- ask_btn = gr.Button("Ask", variant="primary", size="sm")
867
- reset_btn = gr.Button("Clear", variant="secondary", size="sm")
868
- demo_btn = gr.Button("Load demo dataset", variant="secondary", size="sm",
869
- elem_id="load_demo_btn")
870
-
871
- # Result of latest query (single-shot, replaces previous on each Ask)
872
- history_state = gr.State([])
873
- conversation = gr.HTML(_conversation_html([]))
 
 
 
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(