Spaces:
Sleeping
Sleeping
feat: Modern Gradio 6 UI redesign with custom theme and tabbed interface
Browse files
app.py
CHANGED
|
@@ -1,19 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import gradio as gr
|
|
|
|
|
|
|
| 3 |
|
| 4 |
-
#
|
| 5 |
MODAL_API_URL = os.environ.get("MODAL_API_URL")
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
This Space requires a `MODAL_API_URL` secret to be configured.
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
1. **Deploy Modal Backend** (if not done already):
|
| 19 |
```bash
|
|
@@ -30,18 +99,253 @@ if not MODAL_API_URL:
|
|
| 30 |
3. **Restart this Space** (it will restart automatically after adding the secret)
|
| 31 |
|
| 32 |
For more details, see the [DEPLOY.md](DEPLOY.md) file.
|
| 33 |
-
"""
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
-
|
| 43 |
-
demo = create_interface(backend)
|
| 44 |
|
| 45 |
if __name__ == "__main__":
|
| 46 |
-
demo
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
DebugGenie - Modern Gradio 6 UI
|
| 3 |
+
Redesigned for MCP 1st Birthday Hackathon
|
| 4 |
+
"""
|
| 5 |
import os
|
| 6 |
import gradio as gr
|
| 7 |
+
import asyncio
|
| 8 |
+
from theme import debuggenie_theme
|
| 9 |
|
| 10 |
+
# Check if Modal URL is configured
|
| 11 |
MODAL_API_URL = os.environ.get("MODAL_API_URL")
|
| 12 |
|
| 13 |
+
def create_hero_section():
|
| 14 |
+
"""Create the hero/header section with branding."""
|
| 15 |
+
return gr.Markdown("""
|
| 16 |
+
# 🧞 DebugGenie
|
| 17 |
+
### AI-Powered Multi-Agent Debugging Assistant
|
| 18 |
+
*Enterprise-grade error analysis powered by Claude, Gemini, and GPT-4*
|
| 19 |
+
|
| 20 |
+
<div style="background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 100%);
|
| 21 |
+
height: 4px; border-radius: 2px; margin: 20px 0;"></div>
|
| 22 |
+
""")
|
| 23 |
+
|
| 24 |
+
def create_main_interface():
|
| 25 |
+
"""Create the main tabbed interface."""
|
| 26 |
+
|
| 27 |
+
with gr.Blocks(
|
| 28 |
+
theme=debuggenie_theme,
|
| 29 |
+
title="DebugGenie - AI Debugging Assistant",
|
| 30 |
+
css="""
|
| 31 |
+
.gradio-container {
|
| 32 |
+
max-width: 1400px !important;
|
| 33 |
+
}
|
| 34 |
+
.agent-card {
|
| 35 |
+
background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
|
| 36 |
+
border-left: 4px solid #6366f1;
|
| 37 |
+
padding: 16px;
|
| 38 |
+
border-radius: 8px;
|
| 39 |
+
margin: 8px 0;
|
| 40 |
+
}
|
| 41 |
+
.solution-card {
|
| 42 |
+
border: 2px solid #475569;
|
| 43 |
+
border-radius: 12px;
|
| 44 |
+
padding: 20px;
|
| 45 |
+
background: #1e293b;
|
| 46 |
+
transition: all 0.3s ease;
|
| 47 |
+
}
|
| 48 |
+
.solution-card:hover {
|
| 49 |
+
border-color: #6366f1;
|
| 50 |
+
transform: translateY(-2px);
|
| 51 |
+
box-shadow: 0 10px 20px rgba(99, 102, 241, 0.2);
|
| 52 |
+
}
|
| 53 |
+
.confidence-badge {
|
| 54 |
+
display: inline-block;
|
| 55 |
+
padding: 6px 12px;
|
| 56 |
+
border-radius: 20px;
|
| 57 |
+
font-weight: bold;
|
| 58 |
+
font-size: 14px;
|
| 59 |
+
}
|
| 60 |
+
.high-confidence {
|
| 61 |
+
background: linear-gradient(90deg, #10b981 0%, #059669 100%);
|
| 62 |
+
color: white;
|
| 63 |
+
}
|
| 64 |
+
.medium-confidence {
|
| 65 |
+
background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
|
| 66 |
+
color: white;
|
| 67 |
+
}
|
| 68 |
+
.low-confidence {
|
| 69 |
+
background: linear-gradient(90deg, #6b7280 0%, #4b5563 100%);
|
| 70 |
+
color: white;
|
| 71 |
+
}
|
| 72 |
+
"""
|
| 73 |
+
) as demo:
|
| 74 |
+
|
| 75 |
+
# Hero Section
|
| 76 |
+
create_hero_section()
|
| 77 |
+
|
| 78 |
+
# Configuration Check
|
| 79 |
+
if not MODAL_API_URL:
|
| 80 |
+
gr.Markdown("""
|
| 81 |
+
## ⚠️ Configuration Required
|
| 82 |
|
| 83 |
This Space requires a `MODAL_API_URL` secret to be configured.
|
| 84 |
|
| 85 |
+
### Setup Instructions:
|
| 86 |
|
| 87 |
1. **Deploy Modal Backend** (if not done already):
|
| 88 |
```bash
|
|
|
|
| 99 |
3. **Restart this Space** (it will restart automatically after adding the secret)
|
| 100 |
|
| 101 |
For more details, see the [DEPLOY.md](DEPLOY.md) file.
|
| 102 |
+
""")
|
| 103 |
+
else:
|
| 104 |
+
# Main content - only show if configured
|
| 105 |
+
with gr.Tabs() as tabs:
|
| 106 |
+
# TAB 1: ANALYZE
|
| 107 |
+
with gr.Tab("📝 Analyze", id=0):
|
| 108 |
+
with gr.Row():
|
| 109 |
+
# LEFT COLUMN: Input Panel
|
| 110 |
+
with gr.Column(scale=2):
|
| 111 |
+
gr.Markdown("### 📥 Error Input")
|
| 112 |
+
|
| 113 |
+
error_input = gr.Textbox(
|
| 114 |
+
label="Error Message / Stack Trace",
|
| 115 |
+
placeholder="Paste your error message, stack trace, or describe the bug...",
|
| 116 |
+
lines=8,
|
| 117 |
+
max_lines=15
|
| 118 |
+
)
|
| 119 |
+
|
| 120 |
+
with gr.Row():
|
| 121 |
+
screenshot_input = gr.Image(
|
| 122 |
+
label="📸 Screenshot (Optional)",
|
| 123 |
+
type="pil",
|
| 124 |
+
height=200
|
| 125 |
+
)
|
| 126 |
+
files_input = gr.File(
|
| 127 |
+
label="📁 Code Files (Optional)",
|
| 128 |
+
file_count="multiple",
|
| 129 |
+
file_types=[".py", ".js", ".java", ".cpp", ".ts"]
|
| 130 |
+
)
|
| 131 |
+
|
| 132 |
+
with gr.Row():
|
| 133 |
+
analyze_btn = gr.Button(
|
| 134 |
+
"🔍 Analyze Error",
|
| 135 |
+
variant="primary",
|
| 136 |
+
size="lg",
|
| 137 |
+
scale=2
|
| 138 |
+
)
|
| 139 |
+
clear_btn = gr.Button(
|
| 140 |
+
"🗑️ Clear",
|
| 141 |
+
variant="secondary",
|
| 142 |
+
size="lg",
|
| 143 |
+
scale=1
|
| 144 |
+
)
|
| 145 |
+
|
| 146 |
+
# RIGHT COLUMN: Live Analysis Panel
|
| 147 |
+
with gr.Column(scale=3):
|
| 148 |
+
gr.Markdown("### 🤖 Live Agent Collaboration")
|
| 149 |
+
|
| 150 |
+
agent_status = gr.Chatbot(
|
| 151 |
+
label="",
|
| 152 |
+
type="messages",
|
| 153 |
+
height=300,
|
| 154 |
+
bubble_full_width=False,
|
| 155 |
+
show_copy_button=True
|
| 156 |
+
)
|
| 157 |
+
|
| 158 |
+
status_bar = gr.Markdown(
|
| 159 |
+
"**Status:** Ready to analyze",
|
| 160 |
+
elem_classes=["agent-card"]
|
| 161 |
+
)
|
| 162 |
+
|
| 163 |
+
# Results Section
|
| 164 |
+
gr.Markdown("---")
|
| 165 |
+
gr.Markdown("## 🎯 Analysis Results")
|
| 166 |
+
|
| 167 |
+
with gr.Row():
|
| 168 |
+
root_cause_box = gr.Markdown(
|
| 169 |
+
"Results will appear here after analysis...",
|
| 170 |
+
elem_classes=["solution-card"]
|
| 171 |
+
)
|
| 172 |
+
|
| 173 |
+
gr.Markdown("### 💡 Recommended Solutions")
|
| 174 |
+
|
| 175 |
+
with gr.Row():
|
| 176 |
+
solution_1 = gr.Markdown(visible=False)
|
| 177 |
+
solution_2 = gr.Markdown(visible=False)
|
| 178 |
+
solution_3 = gr.Markdown(visible=False)
|
| 179 |
+
|
| 180 |
+
with gr.Row():
|
| 181 |
+
export_md_btn = gr.DownloadButton(
|
| 182 |
+
"📄 Export as Markdown",
|
| 183 |
+
visible=False,
|
| 184 |
+
variant="secondary"
|
| 185 |
+
)
|
| 186 |
+
export_json_btn = gr.DownloadButton(
|
| 187 |
+
"📊 Export as JSON",
|
| 188 |
+
visible=False,
|
| 189 |
+
variant="secondary"
|
| 190 |
+
)
|
| 191 |
+
voice_btn = gr.Button(
|
| 192 |
+
"🔊 Generate Voice Explanation",
|
| 193 |
+
visible=False,
|
| 194 |
+
variant="secondary"
|
| 195 |
+
)
|
| 196 |
+
|
| 197 |
+
audio_output = gr.Audio(
|
| 198 |
+
label="AI Voice Explanation",
|
| 199 |
+
visible=False,
|
| 200 |
+
interactive=False
|
| 201 |
+
)
|
| 202 |
+
|
| 203 |
+
# TAB 2: REPORTS
|
| 204 |
+
with gr.Tab("📊 Reports", id=1):
|
| 205 |
+
gr.Markdown("### Analysis Reports")
|
| 206 |
+
gr.Markdown("*Coming soon: Comprehensive analysis reports and statistics*")
|
| 207 |
+
|
| 208 |
+
# TAB 3: HISTORY
|
| 209 |
+
with gr.Tab("🎯 History", id=2):
|
| 210 |
+
gr.Markdown("### Analysis History")
|
| 211 |
+
history_df = gr.Dataframe(
|
| 212 |
+
headers=["Timestamp", "Error Type", "Confidence", "Status"],
|
| 213 |
+
datatype=["str", "str", "number", "str"],
|
| 214 |
+
row_count=(5, "dynamic"),
|
| 215 |
+
col_count=(4, "fixed"),
|
| 216 |
+
)
|
| 217 |
+
|
| 218 |
+
# TAB 4: SETTINGS
|
| 219 |
+
with gr.Tab("⚙️ Settings", id=3):
|
| 220 |
+
gr.Markdown("### Configuration")
|
| 221 |
+
|
| 222 |
+
with gr.Row():
|
| 223 |
+
model_choice = gr.Dropdown(
|
| 224 |
+
choices=["All Agents", "Claude Only", "Gemini Only", "GPT-4 Only"],
|
| 225 |
+
value="All Agents",
|
| 226 |
+
label="Agent Selection"
|
| 227 |
+
)
|
| 228 |
+
voice_enabled = gr.Checkbox(
|
| 229 |
+
label="Enable Voice Explanations",
|
| 230 |
+
value=True
|
| 231 |
+
)
|
| 232 |
+
|
| 233 |
+
api_status = gr.Markdown(f"""
|
| 234 |
+
**Modal Backend:** {'✅ Connected' if MODAL_API_URL else '❌ Not Configured'}
|
| 235 |
+
|
| 236 |
+
**Endpoint:** `{MODAL_API_URL or 'Not set'}`
|
| 237 |
+
""")
|
| 238 |
+
|
| 239 |
+
# Event Handlers
|
| 240 |
+
def mock_analyze(error_text, screenshot, files, progress=gr.Progress()):
|
| 241 |
+
"""Mock analysis function for demo purposes."""
|
| 242 |
+
import time
|
| 243 |
+
|
| 244 |
+
# Simulate agent collaboration
|
| 245 |
+
messages = []
|
| 246 |
+
|
| 247 |
+
progress(0.1, desc="Initializing agents...")
|
| 248 |
+
messages.append({
|
| 249 |
+
"role": "assistant",
|
| 250 |
+
"content": "🤖 **Claude:** Starting syntax analysis..."
|
| 251 |
+
})
|
| 252 |
+
yield messages, "**Status:** 🔍 Analyzing with Claude...", gr.update(), gr.update(), gr.update(), gr.update()
|
| 253 |
+
time.sleep(0.5)
|
| 254 |
+
|
| 255 |
+
progress(0.3, desc="Claude analyzing...")
|
| 256 |
+
messages.append({
|
| 257 |
+
"role": "assistant",
|
| 258 |
+
"content": "🧠 **Gemini:** Checking imports and dependencies..."
|
| 259 |
+
})
|
| 260 |
+
yield messages, "**Status:** 🧠 Gemini analyzing imports...", gr.update(), gr.update(), gr.update(), gr.update()
|
| 261 |
+
time.sleep(0.5)
|
| 262 |
+
|
| 263 |
+
progress(0.5, desc="Gemini analyzing...")
|
| 264 |
+
messages.append({
|
| 265 |
+
"role": "assistant",
|
| 266 |
+
"content": "💡 **GPT-4:** Searching for similar issues and solutions..."
|
| 267 |
+
})
|
| 268 |
+
yield messages, "**Status:** 💡 GPT-4 finding solutions...", gr.update(), gr.update(), gr.update(), gr.update()
|
| 269 |
+
time.sleep(0.5)
|
| 270 |
+
|
| 271 |
+
progress(0.8, desc="Synthesizing results...")
|
| 272 |
+
|
| 273 |
+
# Final results
|
| 274 |
+
root_cause = """
|
| 275 |
+
<div class="solution-card">
|
| 276 |
+
<h3>🎯 Root Cause Identified</h3>
|
| 277 |
+
<p>Based on multi-agent analysis, the issue is likely caused by a <strong>missing import statement</strong>
|
| 278 |
+
or an <strong>incorrect module path</strong>.</p>
|
| 279 |
+
<p><span class="confidence-badge high-confidence">98% Confidence</span></p>
|
| 280 |
+
</div>
|
| 281 |
+
"""
|
| 282 |
+
|
| 283 |
+
sol1 = """
|
| 284 |
+
<div class="solution-card">
|
| 285 |
+
<h4>✅ Solution 1: Add Missing Import</h4>
|
| 286 |
+
<p>Import the required module at the top of your file.</p>
|
| 287 |
+
<pre><code>from module_name import ClassName</code></pre>
|
| 288 |
+
<p><span class="confidence-badge high-confidence">95% Confidence</span></p>
|
| 289 |
+
</div>
|
| 290 |
+
"""
|
| 291 |
+
|
| 292 |
+
sol2 = """
|
| 293 |
+
<div class="solution-card">
|
| 294 |
+
<h4>💡 Solution 2: Check Module Path</h4>
|
| 295 |
+
<p>Verify that the module is in your Python path.</p>
|
| 296 |
+
<p><span class="confidence-badge medium-confidence">75% Confidence</span></p>
|
| 297 |
+
</div>
|
| 298 |
+
"""
|
| 299 |
+
|
| 300 |
+
sol3 = """
|
| 301 |
+
<div class="solution-card">
|
| 302 |
+
<h4>🔧 Solution 3: Install Dependencies</h4>
|
| 303 |
+
<p>Install missing packages using pip.</p>
|
| 304 |
+
<pre><code>pip install package-name</code></pre>
|
| 305 |
+
<p><span class="confidence-badge low-confidence">60% Confidence</span></p>
|
| 306 |
+
</div>
|
| 307 |
+
"""
|
| 308 |
+
|
| 309 |
+
progress(1.0, desc="Analysis complete!")
|
| 310 |
+
|
| 311 |
+
yield (
|
| 312 |
+
messages,
|
| 313 |
+
"**Status:** ✅ Analysis complete!",
|
| 314 |
+
root_cause,
|
| 315 |
+
sol1,
|
| 316 |
+
sol2,
|
| 317 |
+
sol3
|
| 318 |
+
)
|
| 319 |
+
|
| 320 |
+
# Wire up the analyze button
|
| 321 |
+
analyze_btn.click(
|
| 322 |
+
fn=mock_analyze,
|
| 323 |
+
inputs=[error_input, screenshot_input, files_input],
|
| 324 |
+
outputs=[agent_status, status_bar, root_cause_box, solution_1, solution_2, solution_3]
|
| 325 |
+
)
|
| 326 |
+
|
| 327 |
+
# Clear button
|
| 328 |
+
clear_btn.click(
|
| 329 |
+
fn=lambda: ("", None, None, [], "**Status:** Ready to analyze", "", "", "", ""),
|
| 330 |
+
outputs=[error_input, screenshot_input, files_input, agent_status, status_bar,
|
| 331 |
+
root_cause_box, solution_1, solution_2, solution_3]
|
| 332 |
+
)
|
| 333 |
+
|
| 334 |
+
# Footer
|
| 335 |
+
gr.Markdown("""
|
| 336 |
+
---
|
| 337 |
+
<div style="text-align: center; color: #94a3b8; font-size: 14px;">
|
| 338 |
+
🧞 DebugGenie v2.0 | Powered by Claude, Gemini & GPT-4 |
|
| 339 |
+
<a href="https://github.com/nihald2000/debugging-assistant" style="color: #6366f1;">View on GitHub</a>
|
| 340 |
+
</div>
|
| 341 |
+
""")
|
| 342 |
|
| 343 |
+
return demo
|
|
|
|
| 344 |
|
| 345 |
if __name__ == "__main__":
|
| 346 |
+
demo = create_main_interface()
|
| 347 |
+
demo.launch(
|
| 348 |
+
server_name="0.0.0.0",
|
| 349 |
+
server_port=7860,
|
| 350 |
+
share=False
|
| 351 |
+
)
|
theme.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
DebugGenie Custom Theme for Gradio 6
|
| 3 |
+
Professional dark theme optimized for developer tools
|
| 4 |
+
"""
|
| 5 |
+
import gradio as gr
|
| 6 |
+
|
| 7 |
+
def create_debuggenie_theme():
|
| 8 |
+
"""Create the custom DebugGenie theme with professional dark mode."""
|
| 9 |
+
|
| 10 |
+
theme = gr.themes.Soft(
|
| 11 |
+
primary_hue="indigo",
|
| 12 |
+
secondary_hue="purple",
|
| 13 |
+
neutral_hue="slate",
|
| 14 |
+
font=gr.themes.GoogleFont("Inter"),
|
| 15 |
+
font_mono=gr.themes.GoogleFont("JetBrains Mono"),
|
| 16 |
+
).set(
|
| 17 |
+
# Dark mode background
|
| 18 |
+
body_background_fill="linear-gradient(135deg, #0f172a 0%, #1e293b 100%)",
|
| 19 |
+
body_background_fill_dark="linear-gradient(135deg, #0f172a 0%, #1e293b 100%)",
|
| 20 |
+
|
| 21 |
+
# Panel backgrounds
|
| 22 |
+
panel_background_fill="#1e293b",
|
| 23 |
+
panel_background_fill_dark="#1e293b",
|
| 24 |
+
|
| 25 |
+
# Input backgrounds
|
| 26 |
+
input_background_fill="#334155",
|
| 27 |
+
input_background_fill_dark="#334155",
|
| 28 |
+
input_background_fill_focus="#475569",
|
| 29 |
+
input_background_fill_focus_dark="#475569",
|
| 30 |
+
|
| 31 |
+
# Button styles
|
| 32 |
+
button_primary_background_fill="#6366f1",
|
| 33 |
+
button_primary_background_fill_hover="#818cf8",
|
| 34 |
+
button_primary_background_fill_dark="#6366f1",
|
| 35 |
+
button_primary_text_color="white",
|
| 36 |
+
|
| 37 |
+
button_secondary_background_fill="#8b5cf6",
|
| 38 |
+
button_secondary_background_fill_hover="#a78bfa",
|
| 39 |
+
button_secondary_text_color="white",
|
| 40 |
+
|
| 41 |
+
# Success/Error colors
|
| 42 |
+
button_cancel_background_fill="#ef4444",
|
| 43 |
+
button_cancel_background_fill_hover="#f87171",
|
| 44 |
+
|
| 45 |
+
# Text colors
|
| 46 |
+
body_text_color="#f1f5f9",
|
| 47 |
+
body_text_color_dark="#f1f5f9",
|
| 48 |
+
body_text_color_subdued="#cbd5e1",
|
| 49 |
+
|
| 50 |
+
# Border colors
|
| 51 |
+
border_color_primary="#475569",
|
| 52 |
+
border_color_primary_dark="#475569",
|
| 53 |
+
|
| 54 |
+
# Shadows for depth
|
| 55 |
+
shadow_drop="0 10px 15px -3px rgba(0, 0, 0, 0.3)",
|
| 56 |
+
shadow_drop_lg="0 20px 25px -5px rgba(0, 0, 0, 0.4)",
|
| 57 |
+
|
| 58 |
+
# Typography sizes
|
| 59 |
+
text_lg="18px",
|
| 60 |
+
text_md="16px",
|
| 61 |
+
text_sm="14px",
|
| 62 |
+
text_xs="12px",
|
| 63 |
+
|
| 64 |
+
# Spacing
|
| 65 |
+
spacing_lg="24px",
|
| 66 |
+
spacing_md="16px",
|
| 67 |
+
spacing_sm="12px",
|
| 68 |
+
|
| 69 |
+
# Radius for rounded corners
|
| 70 |
+
radius_lg="12px",
|
| 71 |
+
radius_md="8px",
|
| 72 |
+
radius_sm="6px",
|
| 73 |
+
)
|
| 74 |
+
|
| 75 |
+
return theme
|
| 76 |
+
|
| 77 |
+
# Create the theme instance
|
| 78 |
+
debuggenie_theme = create_debuggenie_theme()
|