VibecoderMcSwaggins commited on
Commit
f236de1
Β·
1 Parent(s): 6c9bd42

fix: upgrade Gradio SDK to 6.0.1 and add fill_height for HF Spaces UI fix

Browse files

Root cause: HuggingFace Spaces was deploying with sdk_version 5.33.0,
but the UI cutoff bug (top content hidden beneath HF banner) was fixed
in Gradio 5.36 via PR #11427.

Changes:
- README.md: sdk_version "5.33.0" β†’ "6.0.1" (latest stable)
- src/app.py: Added fill_height=True to gr.Blocks() for proper layout
- docs/bugs/001_gradio_ui_cutoff.md: Full investigation documentation

Fixes #31

References:
- https://github.com/gradio-app/gradio/issues/11417
- https://github.com/gradio-app/gradio/pull/11427

Files changed (3) hide show
  1. README.md +1 -1
  2. docs/bugs/001_gradio_ui_cutoff.md +135 -0
  3. src/app.py +1 -0
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 🧬
4
  colorFrom: blue
5
  colorTo: purple
6
  sdk: gradio
7
- sdk_version: "5.33.0"
8
  python_version: "3.11"
9
  app_file: src/app.py
10
  pinned: false
 
4
  colorFrom: blue
5
  colorTo: purple
6
  sdk: gradio
7
+ sdk_version: "6.0.1"
8
  python_version: "3.11"
9
  app_file: src/app.py
10
  pinned: false
docs/bugs/001_gradio_ui_cutoff.md ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # BUG-001: Gradio UI Header Cut Off on HuggingFace Spaces
2
+
3
+ **Status:** 🟑 Fix Implemented (Pending Deploy)
4
+ **Severity:** Medium (UI/UX)
5
+ **Reported:** 2025-11-26
6
+ **Branch:** `fix/gradio-ui-scrolling`
7
+ **Related GitHub Issue:** #31
8
+
9
+ ---
10
+
11
+ ## Problem Description
12
+
13
+ The top portion of the Gradio app (title, description, markdown blocks) is cut off and hidden beneath the HuggingFace Spaces banner. Users cannot scroll up to see this content.
14
+
15
+ **Symptoms:**
16
+ - Top content (title "🧬 DeepCritical", description) invisible
17
+ - Unable to scroll up to see hidden content
18
+ - Issue disappears when resizing browser or zooming in/out
19
+ - Most prominent on mobile devices
20
+ - Works fine when running locally (without HF banner)
21
+
22
+ ---
23
+
24
+ ## Root Cause Analysis
25
+
26
+ ### Finding 1: SDK Version Mismatch
27
+
28
+ | Location | Gradio Version |
29
+ |----------|----------------|
30
+ | Local development (`uv pip show gradio`) | **6.0.1** |
31
+ | HuggingFace Spaces (`README.md` frontmatter) | **5.33.0** |
32
+ | Bug fix released in | **5.36** |
33
+
34
+ **Root Cause:** HuggingFace Spaces is deploying with `sdk_version: "5.33.0"` which is **before** the fix in 5.36.
35
+
36
+ ### Finding 2: Known Gradio Issue
37
+
38
+ This is a **known issue** reported during the same MCP hackathon:
39
+
40
+ - **GitHub Issue:** [#11417 - Top of gradio app cut off by huggingface banner](https://github.com/gradio-app/gradio/issues/11417)
41
+ - **Status:** Closed (Fixed)
42
+ - **Fixed in:** Gradio 5.36 via [PR #11427](https://github.com/gradio-app/gradio/pull/11427)
43
+ - **Fix description:** "Rendering of visible components" improvement
44
+
45
+ ### Finding 3: Missing Layout Parameters
46
+
47
+ Current `app.py` does **not** use recommended layout parameters:
48
+
49
+ ```python
50
+ # Current (problematic):
51
+ with gr.Blocks(title="DeepCritical - Drug Repurposing Research Agent") as demo:
52
+
53
+ # Recommended:
54
+ with gr.Blocks(title="...", fill_height=True) as demo:
55
+ ```
56
+
57
+ ---
58
+
59
+ ## Solution
60
+
61
+ ### Primary Fix: Upgrade SDK Version
62
+
63
+ Update `README.md` frontmatter:
64
+
65
+ ```yaml
66
+ # Before (broken):
67
+ sdk_version: "5.33.0"
68
+
69
+ # After (fixed - use 5.36+ or latest 6.x):
70
+ sdk_version: "6.0.1"
71
+ ```
72
+
73
+ ### Secondary Fix: Add fill_height Parameter
74
+
75
+ Update `src/app.py`:
76
+
77
+ ```python
78
+ with gr.Blocks(
79
+ title="DeepCritical - Drug Repurposing Research Agent",
80
+ fill_height=True, # <-- Add this
81
+ ) as demo:
82
+ ```
83
+
84
+ ### Tertiary Fix: CSS Workaround (if needed)
85
+
86
+ ```python
87
+ css = """
88
+ #chatbot {
89
+ flex-grow: 1 !important;
90
+ overflow: auto !important;
91
+ }
92
+ """
93
+
94
+ with gr.Blocks(
95
+ title="...",
96
+ fill_height=True,
97
+ css=css,
98
+ ) as demo:
99
+ ```
100
+
101
+ ---
102
+
103
+ ## References
104
+
105
+ - [GitHub Issue #11417](https://github.com/gradio-app/gradio/issues/11417) - Original bug report (same hackathon!)
106
+ - [GitHub PR #11427](https://github.com/gradio-app/gradio/pull/11427) - Fix PR
107
+ - [Stack Overflow: Gradio ChatInterface CSS height](https://stackoverflow.com/questions/79084620/how-can-i-adjust-the-height-of-a-gradio-chatinterface-component-using-css)
108
+ - [Stack Overflow: Gradio screen appearance](https://stackoverflow.com/questions/78536986/a-chat-with-gradio-how-to-modify-its-screen-appearance)
109
+ - [GitHub Issue #9923](https://github.com/gradio-app/gradio/issues/9923) - ChatInterface squished in Blocks
110
+
111
+ ---
112
+
113
+ ## Action Items
114
+
115
+ 1. [x] Update `README.md` sdk_version from "5.33.0" to "6.0.1" (or latest) - **DONE**
116
+ 2. [x] Add `fill_height=True` to `gr.Blocks()` in `src/app.py` - **DONE**
117
+ 3. [x] Run `make check` - 101 tests passed
118
+ 4. [ ] Deploy to HuggingFace Spaces and verify fix
119
+ 5. [ ] Close GitHub Issue #31 when verified
120
+
121
+ ---
122
+
123
+ ## Investigation Timeline
124
+
125
+ | Time | Action | Finding |
126
+ |------|--------|---------|
127
+ | 18:52 | Created branch `fix/gradio-ui-scrolling` | - |
128
+ | 18:52 | Web searched "Gradio 2025 ChatInterface top content cut off" | Found Issue #11417 |
129
+ | 18:53 | Fetched Issue #11417 details | Fixed in 5.36 via PR #11427 |
130
+ | 18:53 | Checked local Gradio version | 6.0.1 |
131
+ | 18:54 | Checked README.md sdk_version | **5.33.0** (before fix!) |
132
+ | 18:55 | Confirmed root cause | SDK version mismatch |
133
+ | 19:00 | Updated README.md sdk_version | "5.33.0" β†’ "6.0.1" |
134
+ | 19:00 | Added fill_height=True to app.py | Both fixes applied |
135
+ | 19:02 | Ran `make check` | 101 tests passed |
src/app.py CHANGED
@@ -183,6 +183,7 @@ def create_demo() -> Any:
183
  """
184
  with gr.Blocks(
185
  title="DeepCritical - Drug Repurposing Research Agent",
 
186
  ) as demo:
187
  gr.Markdown("""
188
  # 🧬 DeepCritical
 
183
  """
184
  with gr.Blocks(
185
  title="DeepCritical - Drug Repurposing Research Agent",
186
+ fill_height=True,
187
  ) as demo:
188
  gr.Markdown("""
189
  # 🧬 DeepCritical