VibecoderMcSwaggins commited on
Commit
7920e92
Β·
1 Parent(s): abb7e9b

docs: Add Gradio architecture clarification to SPEC-23

Browse files

- Document gr.Blocks vs gr.Interface vs gr.ChatInterface hierarchy
- Clarify ChatInterface inherits from Blocks (not mixing paradigms)
- Add version pinning: Gradio 6.0.1 (December 2025)
- Confirm ChatInterface is correct choice for chat apps

docs/specs/SPEC-23-GRADIO-MODERNIZATION.md CHANGED
@@ -4,6 +4,8 @@
4
  **Priority:** P3 (Technical alignment)
5
  **Effort:** 30 minutes
6
  **Dependencies:** SPEC-22 (Progress Bar Removal)
 
 
7
 
8
  ---
9
 
@@ -13,6 +15,46 @@ Audit of `src/app.py` against Gradio 6.0.1 best practices. Identifies parameters
13
 
14
  ---
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  ## Current State vs Best Practices
17
 
18
  | Feature | Current | Best Practice | Action |
 
4
  **Priority:** P3 (Technical alignment)
5
  **Effort:** 30 minutes
6
  **Dependencies:** SPEC-22 (Progress Bar Removal)
7
+ **Gradio Version:** 6.0.1 (December 2025)
8
+ **Last Verified:** 2025-12-07
9
 
10
  ---
11
 
 
15
 
16
  ---
17
 
18
+ ## Gradio Architecture Clarification
19
+
20
+ ### The Three High-Level Classes
21
+
22
+ | Class | Purpose | Flexibility | Use Case |
23
+ |-------|---------|-------------|----------|
24
+ | `gr.Blocks` | Low-level building blocks | Most flexible | Custom layouts, multiple components |
25
+ | `gr.Interface` | Input β†’ Output wrapper | Medium | ML models, transformations |
26
+ | `gr.ChatInterface` | Chat app wrapper | Opinionated | **Chatbots (what we use)** |
27
+
28
+ ### Inheritance Hierarchy
29
+
30
+ ```
31
+ gr.Blocks (base)
32
+ ↑
33
+ gr.ChatInterface (inherits from Blocks, adds chat-specific features)
34
+ ```
35
+
36
+ **Key insight:** `ChatInterface` IS a `Blocks` context internally. We're not mixing different things - we're using the right abstraction for a chat app.
37
+
38
+ ### What ChatInterface Gives Us (For Free)
39
+
40
+ - Chat history state management
41
+ - Submit/Stop buttons
42
+ - Streaming support
43
+ - Example handling
44
+ - `additional_inputs` accordion
45
+ - MCP server support (`mcp_server=True`)
46
+
47
+ ### When Would We Need Pure `gr.Blocks`?
48
+
49
+ Only if we needed:
50
+ - Multiple independent chat windows
51
+ - Complex multi-panel layouts
52
+ - Non-chat components as primary UI
53
+
54
+ **Verdict:** `ChatInterface` is the correct choice for DeepBoner.
55
+
56
+ ---
57
+
58
  ## Current State vs Best Practices
59
 
60
  | Feature | Current | Best Practice | Action |