TomLii commited on
Commit
c6143d7
·
1 Parent(s): f63a0cf

Use fill_width and fixed min sizes so initial layout matches post-answer

Browse files
Files changed (1) hide show
  1. app.py +21 -6
app.py CHANGED
@@ -129,12 +129,14 @@ html, body, gradio-app, [class*="gradio-container"] {
129
  background: #f5f9ff !important;
130
  }
131
 
132
- /* The Space iframe wraps Gradio in <gradio-app>; force it to fill viewport so the
133
- container width never depends on inner content (otherwise Code/Markdown content
134
- will visibly resize the whole page after the first answer arrives). */
 
135
  gradio-app {
136
  display: block !important;
137
  width: 100% !important;
 
138
  margin-left: auto !important;
139
  margin-right: auto !important;
140
  }
@@ -148,8 +150,8 @@ gradio-app > div {
148
 
149
  [class*="gradio-container"] {
150
  max-width: 1480px !important;
151
- width: 92vw !important;
152
- min-width: 0 !important;
153
  margin-left: auto !important;
154
  margin-right: auto !important;
155
  padding-left: 28px !important;
@@ -163,10 +165,22 @@ gradio-app > div {
163
  [class*="gradio-container"] .layout-gap {
164
  width: 100% !important;
165
  }
166
- [class*="gradio-container"] .layout-gap > .gr-column {
 
167
  min-width: 0 !important;
168
  }
169
 
 
 
 
 
 
 
 
 
 
 
 
170
  /* Prevent Code / Markdown from pushing the page wider than the container. */
171
  [class*="gradio-container"] .codemirror-wrapper,
172
  [class*="gradio-container"] .cm-editor,
@@ -904,6 +918,7 @@ with gr.Blocks(
904
  title="DeepResearch Space Starter",
905
  theme=APP_THEME,
906
  css=CUSTOM_CSS,
 
907
  ) as demo:
908
  with gr.Row(elem_classes="layout-gap"):
909
  with gr.Column(scale=7):
 
129
  background: #f5f9ff !important;
130
  }
131
 
132
+ /* HF Space iframe wraps Gradio in <gradio-app>. Force every wrapper to stretch to
133
+ the full viewport from the FIRST paint so the page doesn't visibly grow after
134
+ the first answer arrives. */
135
+ html, body { width: 100% !important; min-height: 100vh !important; margin: 0 !important; }
136
  gradio-app {
137
  display: block !important;
138
  width: 100% !important;
139
+ min-height: 100vh !important;
140
  margin-left: auto !important;
141
  margin-right: auto !important;
142
  }
 
150
 
151
  [class*="gradio-container"] {
152
  max-width: 1480px !important;
153
+ width: 100% !important;
154
+ min-width: 320px !important;
155
  margin-left: auto !important;
156
  margin-right: auto !important;
157
  padding-left: 28px !important;
 
165
  [class*="gradio-container"] .layout-gap {
166
  width: 100% !important;
167
  }
168
+ [class*="gradio-container"] .layout-gap > .gr-column,
169
+ [class*="gradio-container"] .layout-gap > div {
170
  min-width: 0 !important;
171
  }
172
 
173
+ /* Reserve vertical space for the Result/Record area so the first answer doesn't
174
+ trigger a visible vertical jump either. */
175
+ [class*="gradio-container"] .gradio-markdown,
176
+ [class*="gradio-container"] [data-testid="markdown"] {
177
+ min-height: 220px !important;
178
+ }
179
+ [class*="gradio-container"] .codemirror-wrapper,
180
+ [class*="gradio-container"] .cm-editor {
181
+ min-height: 220px !important;
182
+ }
183
+
184
  /* Prevent Code / Markdown from pushing the page wider than the container. */
185
  [class*="gradio-container"] .codemirror-wrapper,
186
  [class*="gradio-container"] .cm-editor,
 
918
  title="DeepResearch Space Starter",
919
  theme=APP_THEME,
920
  css=CUSTOM_CSS,
921
+ fill_width=True,
922
  ) as demo:
923
  with gr.Row(elem_classes="layout-gap"):
924
  with gr.Column(scale=7):