Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,20 +11,11 @@ import networkx as nx
|
|
| 11 |
# --- CONFIGURATION ---
|
| 12 |
MODAL_API_URL = os.environ.get("MODAL_API_URL")
|
| 13 |
|
| 14 |
-
# --- CUSTOM CSS ---
|
| 15 |
HACKATHON_CSS = """
|
| 16 |
/* π¨ Global Styles */
|
| 17 |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&family=JetBrains+Mono:wght@400;700&display=swap');
|
| 18 |
|
| 19 |
-
body {
|
| 20 |
-
font-family: 'Inter', sans-serif;
|
| 21 |
-
background-color: #f9fafb;
|
| 22 |
-
}
|
| 23 |
-
|
| 24 |
-
.dark body {
|
| 25 |
-
background-color: #0f172a;
|
| 26 |
-
}
|
| 27 |
-
|
| 28 |
.gradio-container {
|
| 29 |
max-width: 1400px !important;
|
| 30 |
}
|
|
@@ -38,8 +29,6 @@ body {
|
|
| 38 |
text-align: center;
|
| 39 |
margin-bottom: 2rem;
|
| 40 |
box-shadow: 0 10px 25px rgba(30, 64, 175, 0.2);
|
| 41 |
-
position: relative;
|
| 42 |
-
overflow: hidden;
|
| 43 |
}
|
| 44 |
|
| 45 |
.hero-title {
|
|
@@ -49,7 +38,6 @@ body {
|
|
| 49 |
background: linear-gradient(to right, #ffffff, #e0e7ff);
|
| 50 |
-webkit-background-clip: text;
|
| 51 |
-webkit-text-fill-color: transparent;
|
| 52 |
-
text-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
| 53 |
}
|
| 54 |
|
| 55 |
.hero-subtitle {
|
|
@@ -87,31 +75,19 @@ body {
|
|
| 87 |
display: flex;
|
| 88 |
justify-content: center;
|
| 89 |
gap: 3rem;
|
| 90 |
-
margin
|
| 91 |
-
padding:
|
| 92 |
background: white;
|
| 93 |
border-radius: 0.75rem;
|
| 94 |
border: 1px solid #e5e7eb;
|
| 95 |
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
|
| 96 |
}
|
| 97 |
|
| 98 |
-
.dark .stats-container {
|
| 99 |
-
background: #1e293b;
|
| 100 |
-
border-color: #334155;
|
| 101 |
-
}
|
| 102 |
-
|
| 103 |
.stat-item {
|
| 104 |
-
display: flex;
|
| 105 |
-
align-items: center;
|
| 106 |
-
gap: 0.5rem;
|
| 107 |
font-weight: 600;
|
| 108 |
color: #4b5563;
|
| 109 |
}
|
| 110 |
|
| 111 |
-
.dark .stat-item {
|
| 112 |
-
color: #cbd5e1;
|
| 113 |
-
}
|
| 114 |
-
|
| 115 |
/* π€ Agent Activity Monitor */
|
| 116 |
.agent-card {
|
| 117 |
background: white;
|
|
@@ -125,11 +101,6 @@ body {
|
|
| 125 |
gap: 1rem;
|
| 126 |
}
|
| 127 |
|
| 128 |
-
.dark .agent-card {
|
| 129 |
-
background: #1e293b;
|
| 130 |
-
border-color: #334155;
|
| 131 |
-
}
|
| 132 |
-
|
| 133 |
.agent-card:hover {
|
| 134 |
transform: translateX(4px);
|
| 135 |
border-color: #6366f1;
|
|
@@ -147,10 +118,6 @@ body {
|
|
| 147 |
background: #f3f4f6;
|
| 148 |
}
|
| 149 |
|
| 150 |
-
.dark .agent-avatar {
|
| 151 |
-
background: #334155;
|
| 152 |
-
}
|
| 153 |
-
|
| 154 |
.agent-info {
|
| 155 |
flex: 1;
|
| 156 |
}
|
|
@@ -162,19 +129,11 @@ body {
|
|
| 162 |
margin-bottom: 0.25rem;
|
| 163 |
}
|
| 164 |
|
| 165 |
-
.dark .agent-name {
|
| 166 |
-
color: #f3f4f6;
|
| 167 |
-
}
|
| 168 |
-
|
| 169 |
.agent-status {
|
| 170 |
font-size: 0.8rem;
|
| 171 |
color: #6b7280;
|
| 172 |
}
|
| 173 |
|
| 174 |
-
.dark .agent-status {
|
| 175 |
-
color: #9ca3af;
|
| 176 |
-
}
|
| 177 |
-
|
| 178 |
/* π’ Status Indicators */
|
| 179 |
.status-dot {
|
| 180 |
width: 10px;
|
|
@@ -183,9 +142,19 @@ body {
|
|
| 183 |
display: inline-block;
|
| 184 |
}
|
| 185 |
|
| 186 |
-
.status-dot.waiting {
|
| 187 |
-
|
| 188 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
|
| 190 |
@keyframes pulse {
|
| 191 |
0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
|
|
@@ -204,12 +173,6 @@ body {
|
|
| 204 |
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
|
| 205 |
}
|
| 206 |
|
| 207 |
-
.dark .solution-card {
|
| 208 |
-
background: #1e293b;
|
| 209 |
-
border-color: #334155;
|
| 210 |
-
border-left-color: #10b981;
|
| 211 |
-
}
|
| 212 |
-
|
| 213 |
.rank-badge {
|
| 214 |
background: linear-gradient(135deg, #10b981 0%, #059669 100%);
|
| 215 |
color: white;
|
|
@@ -230,10 +193,6 @@ body {
|
|
| 230 |
overflow: hidden;
|
| 231 |
}
|
| 232 |
|
| 233 |
-
.dark .confidence-bar-bg {
|
| 234 |
-
background: #334155;
|
| 235 |
-
}
|
| 236 |
-
|
| 237 |
.confidence-bar-fill {
|
| 238 |
height: 100%;
|
| 239 |
background: linear-gradient(90deg, #10b981 0%, #3b82f6 100%);
|
|
@@ -254,13 +213,18 @@ def generate_agent_html(agent_name, status, message, progress):
|
|
| 254 |
"""Generates HTML for a single agent card."""
|
| 255 |
|
| 256 |
status_class = "waiting"
|
| 257 |
-
if status == "processing":
|
| 258 |
-
|
|
|
|
|
|
|
| 259 |
|
| 260 |
icon = "π€"
|
| 261 |
-
if "Claude" in agent_name:
|
| 262 |
-
|
| 263 |
-
elif "
|
|
|
|
|
|
|
|
|
|
| 264 |
|
| 265 |
return f"""
|
| 266 |
<div class="agent-card">
|
|
@@ -284,24 +248,20 @@ def create_3d_viz():
|
|
| 284 |
edge_x = []
|
| 285 |
edge_y = []
|
| 286 |
edge_z = []
|
|
|
|
| 287 |
for edge in G.edges():
|
| 288 |
x0, y0 = G.nodes[edge[0]]['pos']
|
| 289 |
x1, y1 = G.nodes[edge[1]]['pos']
|
| 290 |
-
edge_x.
|
| 291 |
-
edge_y.
|
| 292 |
-
edge_z.
|
| 293 |
-
edge_x.append(x1)
|
| 294 |
-
edge_y.append(y1)
|
| 295 |
-
edge_z.append(0)
|
| 296 |
-
edge_x.append(None)
|
| 297 |
-
edge_y.append(None)
|
| 298 |
-
edge_z.append(None)
|
| 299 |
|
| 300 |
edge_trace = go.Scatter3d(
|
| 301 |
x=edge_x, y=edge_y, z=edge_z,
|
| 302 |
line=dict(width=0.5, color='#888'),
|
| 303 |
hoverinfo='none',
|
| 304 |
-
mode='lines'
|
|
|
|
| 305 |
|
| 306 |
node_x = []
|
| 307 |
node_y = []
|
|
@@ -328,32 +288,37 @@ def create_3d_viz():
|
|
| 328 |
xanchor='left',
|
| 329 |
titleside='right'
|
| 330 |
),
|
| 331 |
-
line_width=2
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 346 |
return fig
|
| 347 |
|
| 348 |
# --- MAIN APP ---
|
| 349 |
|
| 350 |
def create_app():
|
| 351 |
-
|
|
|
|
| 352 |
|
| 353 |
# 1. HERO SECTION
|
| 354 |
-
with gr.Row(
|
| 355 |
gr.HTML("""
|
| 356 |
-
<div class="hero-
|
| 357 |
<h1 class="hero-title">DebugGenie π§</h1>
|
| 358 |
<p class="hero-subtitle">Multi-Agent AI Debugging Assistant</p>
|
| 359 |
<div class="feature-badges">
|
|
@@ -365,12 +330,13 @@ def create_app():
|
|
| 365 |
""")
|
| 366 |
|
| 367 |
# 2. STATS BAR
|
| 368 |
-
|
| 369 |
-
|
| 370 |
<div class="stat-item">π€ 3 AI Agents Active</div>
|
| 371 |
<div class="stat-item">π§ 5 MCP Tools Connected</div>
|
| 372 |
<div class="stat-item">β‘ Real-time Analysis Ready</div>
|
| 373 |
-
|
|
|
|
| 374 |
|
| 375 |
# 3. MAIN LAYOUT (Two Columns)
|
| 376 |
with gr.Row():
|
|
@@ -382,23 +348,25 @@ def create_app():
|
|
| 382 |
error_input = gr.Code(
|
| 383 |
label="Error Trace / Code Snippet",
|
| 384 |
language="python",
|
| 385 |
-
lines=10
|
| 386 |
-
elem_classes="input-code"
|
| 387 |
)
|
| 388 |
|
| 389 |
with gr.Accordion("πΈ Add Context (Optional)", open=False):
|
| 390 |
-
screenshot_input = gr.Image(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 391 |
|
| 392 |
analyze_btn = gr.Button(
|
| 393 |
"π Analyze Error",
|
| 394 |
variant="primary",
|
| 395 |
-
size="lg"
|
| 396 |
-
elem_id="analyze-btn"
|
| 397 |
)
|
| 398 |
|
| 399 |
with gr.Row():
|
| 400 |
-
gr.Button("π² Try Example", size="sm", variant="secondary")
|
| 401 |
-
gr.Button("ποΈ Clear", size="sm", variant="secondary")
|
| 402 |
|
| 403 |
# RIGHT COLUMN: RESULTS (60%)
|
| 404 |
with gr.Column(scale=3):
|
|
@@ -412,7 +380,8 @@ def create_app():
|
|
| 412 |
)
|
| 413 |
|
| 414 |
# Results Tabs
|
| 415 |
-
|
|
|
|
| 416 |
|
| 417 |
# Tab 1: Solutions
|
| 418 |
with gr.Tab("π― Solutions"):
|
|
@@ -424,10 +393,15 @@ def create_app():
|
|
| 424 |
|
| 425 |
# Tab 3: Raw Logs
|
| 426 |
with gr.Tab("π Agent Logs"):
|
| 427 |
-
chatbot = gr.Chatbot(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 428 |
|
| 429 |
# Voice Player (Bottom)
|
| 430 |
-
|
|
|
|
| 431 |
gr.Markdown("### π Audio Briefing")
|
| 432 |
audio_out = gr.Audio(interactive=False)
|
| 433 |
|
|
@@ -495,15 +469,45 @@ def create_app():
|
|
| 495 |
{"role": "assistant", "content": "I've analyzed the stack trace. The root cause is a missing library."}
|
| 496 |
]
|
| 497 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 498 |
|
|
|
|
| 499 |
analyze_btn.click(
|
| 500 |
analyze_error,
|
| 501 |
inputs=[error_input, screenshot_input],
|
| 502 |
outputs=[agent_monitor, results_tabs, voice_player, solutions_display, viz_plot, chatbot]
|
| 503 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 504 |
|
| 505 |
return demo
|
| 506 |
|
| 507 |
if __name__ == "__main__":
|
| 508 |
demo = create_app()
|
| 509 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
# --- CONFIGURATION ---
|
| 12 |
MODAL_API_URL = os.environ.get("MODAL_API_URL")
|
| 13 |
|
| 14 |
+
# --- CUSTOM CSS (Moved to launch() in Gradio 6) ---
|
| 15 |
HACKATHON_CSS = """
|
| 16 |
/* π¨ Global Styles */
|
| 17 |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&family=JetBrains+Mono:wght@400;700&display=swap');
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
.gradio-container {
|
| 20 |
max-width: 1400px !important;
|
| 21 |
}
|
|
|
|
| 29 |
text-align: center;
|
| 30 |
margin-bottom: 2rem;
|
| 31 |
box-shadow: 0 10px 25px rgba(30, 64, 175, 0.2);
|
|
|
|
|
|
|
| 32 |
}
|
| 33 |
|
| 34 |
.hero-title {
|
|
|
|
| 38 |
background: linear-gradient(to right, #ffffff, #e0e7ff);
|
| 39 |
-webkit-background-clip: text;
|
| 40 |
-webkit-text-fill-color: transparent;
|
|
|
|
| 41 |
}
|
| 42 |
|
| 43 |
.hero-subtitle {
|
|
|
|
| 75 |
display: flex;
|
| 76 |
justify-content: center;
|
| 77 |
gap: 3rem;
|
| 78 |
+
margin: 2rem 0;
|
| 79 |
+
padding: 1.5rem;
|
| 80 |
background: white;
|
| 81 |
border-radius: 0.75rem;
|
| 82 |
border: 1px solid #e5e7eb;
|
| 83 |
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
|
| 84 |
}
|
| 85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
.stat-item {
|
|
|
|
|
|
|
|
|
|
| 87 |
font-weight: 600;
|
| 88 |
color: #4b5563;
|
| 89 |
}
|
| 90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
/* π€ Agent Activity Monitor */
|
| 92 |
.agent-card {
|
| 93 |
background: white;
|
|
|
|
| 101 |
gap: 1rem;
|
| 102 |
}
|
| 103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
.agent-card:hover {
|
| 105 |
transform: translateX(4px);
|
| 106 |
border-color: #6366f1;
|
|
|
|
| 118 |
background: #f3f4f6;
|
| 119 |
}
|
| 120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
.agent-info {
|
| 122 |
flex: 1;
|
| 123 |
}
|
|
|
|
| 129 |
margin-bottom: 0.25rem;
|
| 130 |
}
|
| 131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
.agent-status {
|
| 133 |
font-size: 0.8rem;
|
| 134 |
color: #6b7280;
|
| 135 |
}
|
| 136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
/* π’ Status Indicators */
|
| 138 |
.status-dot {
|
| 139 |
width: 10px;
|
|
|
|
| 142 |
display: inline-block;
|
| 143 |
}
|
| 144 |
|
| 145 |
+
.status-dot.waiting {
|
| 146 |
+
background-color: #ef4444;
|
| 147 |
+
box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
.status-dot.processing {
|
| 151 |
+
background-color: #f59e0b;
|
| 152 |
+
animation: pulse 1.5s infinite;
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
.status-dot.complete {
|
| 156 |
+
background-color: #10b981;
|
| 157 |
+
}
|
| 158 |
|
| 159 |
@keyframes pulse {
|
| 160 |
0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
|
|
|
|
| 173 |
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
|
| 174 |
}
|
| 175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
.rank-badge {
|
| 177 |
background: linear-gradient(135deg, #10b981 0%, #059669 100%);
|
| 178 |
color: white;
|
|
|
|
| 193 |
overflow: hidden;
|
| 194 |
}
|
| 195 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
.confidence-bar-fill {
|
| 197 |
height: 100%;
|
| 198 |
background: linear-gradient(90deg, #10b981 0%, #3b82f6 100%);
|
|
|
|
| 213 |
"""Generates HTML for a single agent card."""
|
| 214 |
|
| 215 |
status_class = "waiting"
|
| 216 |
+
if status == "processing":
|
| 217 |
+
status_class = "processing"
|
| 218 |
+
elif status == "complete":
|
| 219 |
+
status_class = "complete"
|
| 220 |
|
| 221 |
icon = "π€"
|
| 222 |
+
if "Claude" in agent_name:
|
| 223 |
+
icon = "π§ "
|
| 224 |
+
elif "Gemini" in agent_name:
|
| 225 |
+
icon = "β¨"
|
| 226 |
+
elif "GPT-4" in agent_name:
|
| 227 |
+
icon = "β‘"
|
| 228 |
|
| 229 |
return f"""
|
| 230 |
<div class="agent-card">
|
|
|
|
| 248 |
edge_x = []
|
| 249 |
edge_y = []
|
| 250 |
edge_z = []
|
| 251 |
+
|
| 252 |
for edge in G.edges():
|
| 253 |
x0, y0 = G.nodes[edge[0]]['pos']
|
| 254 |
x1, y1 = G.nodes[edge[1]]['pos']
|
| 255 |
+
edge_x.extend([x0, x1, None])
|
| 256 |
+
edge_y.extend([y0, y1, None])
|
| 257 |
+
edge_z.extend([0, 0, None])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 258 |
|
| 259 |
edge_trace = go.Scatter3d(
|
| 260 |
x=edge_x, y=edge_y, z=edge_z,
|
| 261 |
line=dict(width=0.5, color='#888'),
|
| 262 |
hoverinfo='none',
|
| 263 |
+
mode='lines'
|
| 264 |
+
)
|
| 265 |
|
| 266 |
node_x = []
|
| 267 |
node_y = []
|
|
|
|
| 288 |
xanchor='left',
|
| 289 |
titleside='right'
|
| 290 |
),
|
| 291 |
+
line_width=2
|
| 292 |
+
)
|
| 293 |
+
)
|
| 294 |
+
|
| 295 |
+
fig = go.Figure(
|
| 296 |
+
data=[edge_trace, node_trace],
|
| 297 |
+
layout=go.Layout(
|
| 298 |
+
title='Error Dependency Graph',
|
| 299 |
+
titlefont_size=16,
|
| 300 |
+
showlegend=False,
|
| 301 |
+
hovermode='closest',
|
| 302 |
+
margin=dict(b=20, l=5, r=5, t=40),
|
| 303 |
+
scene=dict(
|
| 304 |
+
xaxis=dict(showgrid=False, zeroline=False, showticklabels=False),
|
| 305 |
+
yaxis=dict(showgrid=False, zeroline=False, showticklabels=False),
|
| 306 |
+
zaxis=dict(showgrid=False, zeroline=False, showticklabels=False),
|
| 307 |
+
)
|
| 308 |
+
)
|
| 309 |
+
)
|
| 310 |
return fig
|
| 311 |
|
| 312 |
# --- MAIN APP ---
|
| 313 |
|
| 314 |
def create_app():
|
| 315 |
+
# Create Blocks WITHOUT css and theme (moved to launch)
|
| 316 |
+
with gr.Blocks(title="DebugGenie π§") as demo:
|
| 317 |
|
| 318 |
# 1. HERO SECTION
|
| 319 |
+
with gr.Row():
|
| 320 |
gr.HTML("""
|
| 321 |
+
<div class="hero-section">
|
| 322 |
<h1 class="hero-title">DebugGenie π§</h1>
|
| 323 |
<p class="hero-subtitle">Multi-Agent AI Debugging Assistant</p>
|
| 324 |
<div class="feature-badges">
|
|
|
|
| 330 |
""")
|
| 331 |
|
| 332 |
# 2. STATS BAR
|
| 333 |
+
gr.HTML("""
|
| 334 |
+
<div class="stats-container">
|
| 335 |
<div class="stat-item">π€ 3 AI Agents Active</div>
|
| 336 |
<div class="stat-item">π§ 5 MCP Tools Connected</div>
|
| 337 |
<div class="stat-item">β‘ Real-time Analysis Ready</div>
|
| 338 |
+
</div>
|
| 339 |
+
""")
|
| 340 |
|
| 341 |
# 3. MAIN LAYOUT (Two Columns)
|
| 342 |
with gr.Row():
|
|
|
|
| 348 |
error_input = gr.Code(
|
| 349 |
label="Error Trace / Code Snippet",
|
| 350 |
language="python",
|
| 351 |
+
lines=10
|
|
|
|
| 352 |
)
|
| 353 |
|
| 354 |
with gr.Accordion("πΈ Add Context (Optional)", open=False):
|
| 355 |
+
screenshot_input = gr.Image(
|
| 356 |
+
label="Upload Screenshot",
|
| 357 |
+
type="pil",
|
| 358 |
+
height=200
|
| 359 |
+
)
|
| 360 |
|
| 361 |
analyze_btn = gr.Button(
|
| 362 |
"π Analyze Error",
|
| 363 |
variant="primary",
|
| 364 |
+
size="lg"
|
|
|
|
| 365 |
)
|
| 366 |
|
| 367 |
with gr.Row():
|
| 368 |
+
example_btn = gr.Button("π² Try Example", size="sm", variant="secondary")
|
| 369 |
+
clear_btn = gr.Button("ποΈ Clear", size="sm", variant="secondary")
|
| 370 |
|
| 371 |
# RIGHT COLUMN: RESULTS (60%)
|
| 372 |
with gr.Column(scale=3):
|
|
|
|
| 380 |
)
|
| 381 |
|
| 382 |
# Results Tabs
|
| 383 |
+
results_tabs = gr.Tabs(visible=False)
|
| 384 |
+
with results_tabs:
|
| 385 |
|
| 386 |
# Tab 1: Solutions
|
| 387 |
with gr.Tab("π― Solutions"):
|
|
|
|
| 393 |
|
| 394 |
# Tab 3: Raw Logs
|
| 395 |
with gr.Tab("π Agent Logs"):
|
| 396 |
+
chatbot = gr.Chatbot(
|
| 397 |
+
label="Conversation",
|
| 398 |
+
height=400,
|
| 399 |
+
type="messages"
|
| 400 |
+
)
|
| 401 |
|
| 402 |
# Voice Player (Bottom)
|
| 403 |
+
voice_player = gr.Group(visible=False)
|
| 404 |
+
with voice_player:
|
| 405 |
gr.Markdown("### π Audio Briefing")
|
| 406 |
audio_out = gr.Audio(interactive=False)
|
| 407 |
|
|
|
|
| 469 |
{"role": "assistant", "content": "I've analyzed the stack trace. The root cause is a missing library."}
|
| 470 |
]
|
| 471 |
}
|
| 472 |
+
|
| 473 |
+
def clear_inputs():
|
| 474 |
+
return "", None
|
| 475 |
+
|
| 476 |
+
def load_example():
|
| 477 |
+
return """Traceback (most recent call last):
|
| 478 |
+
File "app.py", line 10, in <module>
|
| 479 |
+
import gradio as gr
|
| 480 |
+
ModuleNotFoundError: No module named 'gradio'""", None
|
| 481 |
|
| 482 |
+
# Event handlers
|
| 483 |
analyze_btn.click(
|
| 484 |
analyze_error,
|
| 485 |
inputs=[error_input, screenshot_input],
|
| 486 |
outputs=[agent_monitor, results_tabs, voice_player, solutions_display, viz_plot, chatbot]
|
| 487 |
)
|
| 488 |
+
|
| 489 |
+
clear_btn.click(
|
| 490 |
+
clear_inputs,
|
| 491 |
+
outputs=[error_input, screenshot_input]
|
| 492 |
+
)
|
| 493 |
+
|
| 494 |
+
example_btn.click(
|
| 495 |
+
load_example,
|
| 496 |
+
outputs=[error_input, screenshot_input]
|
| 497 |
+
)
|
| 498 |
|
| 499 |
return demo
|
| 500 |
|
| 501 |
if __name__ == "__main__":
|
| 502 |
demo = create_app()
|
| 503 |
+
|
| 504 |
+
# Launch with theme and CSS (Gradio 6 requirement)
|
| 505 |
+
demo.launch(
|
| 506 |
+
server_name="0.0.0.0",
|
| 507 |
+
server_port=7860,
|
| 508 |
+
theme=gr.themes.Soft(
|
| 509 |
+
primary_hue="indigo",
|
| 510 |
+
neutral_hue="slate"
|
| 511 |
+
),
|
| 512 |
+
css=HACKATHON_CSS
|
| 513 |
+
)
|