Mandark-droid commited on
Commit
813e1f3
·
1 Parent(s): 10186e7

Add Summary Card tab with leaderboard summary generation

Browse files
Files changed (3) hide show
  1. app.py +19 -0
  2. components/__init__.py +9 -5
  3. components/report_cards.py +593 -0
app.py CHANGED
@@ -19,6 +19,7 @@ from components.analytics_charts import (
19
  create_speed_accuracy_scatter,
20
  create_cost_efficiency_scatter
21
  )
 
22
 
23
  # Initialize data loader
24
  data_loader = create_data_loader_from_env()
@@ -98,6 +99,13 @@ def update_analytics(viz_type):
98
  return create_cost_efficiency_scatter(df)
99
 
100
 
 
 
 
 
 
 
 
101
  # Build Gradio app
102
  with gr.Blocks(title="TraceMind-AI") as app:
103
  gr.Markdown("# 🧠 TraceMind-AI")
@@ -164,6 +172,11 @@ with gr.Blocks(title="TraceMind-AI") as app:
164
  )
165
  analytics_chart = gr.Plot()
166
 
 
 
 
 
 
167
  # Hidden textbox for row selection (JavaScript bridge)
168
  selected_row_index = gr.Textbox(visible=False, elem_id="selected_row_index")
169
 
@@ -202,6 +215,12 @@ with gr.Blocks(title="TraceMind-AI") as app:
202
  outputs=[analytics_chart]
203
  )
204
 
 
 
 
 
 
 
205
 
206
  if __name__ == "__main__":
207
  print("🚀 Starting TraceMind-AI...")
 
19
  create_speed_accuracy_scatter,
20
  create_cost_efficiency_scatter
21
  )
22
+ from components.report_cards import generate_leaderboard_summary_card
23
 
24
  # Initialize data loader
25
  data_loader = create_data_loader_from_env()
 
99
  return create_cost_efficiency_scatter(df)
100
 
101
 
102
+ def generate_card(top_n):
103
+ """Generate summary card HTML"""
104
+ df = data_loader.load_leaderboard()
105
+ html = generate_leaderboard_summary_card(df, top_n)
106
+ return html
107
+
108
+
109
  # Build Gradio app
110
  with gr.Blocks(title="TraceMind-AI") as app:
111
  gr.Markdown("# 🧠 TraceMind-AI")
 
172
  )
173
  analytics_chart = gr.Plot()
174
 
175
+ with gr.TabItem("📥 Summary Card"):
176
+ top_n_slider = gr.Slider(1, 5, 3, step=1, label="Top N Models")
177
+ generate_card_btn = gr.Button("🎨 Generate Card")
178
+ card_preview = gr.HTML()
179
+
180
  # Hidden textbox for row selection (JavaScript bridge)
181
  selected_row_index = gr.Textbox(visible=False, elem_id="selected_row_index")
182
 
 
215
  outputs=[analytics_chart]
216
  )
217
 
218
+ generate_card_btn.click(
219
+ fn=generate_card,
220
+ inputs=[top_n_slider],
221
+ outputs=[card_preview]
222
+ )
223
+
224
 
225
  if __name__ == "__main__":
226
  print("🚀 Starting TraceMind-AI...")
components/__init__.py CHANGED
@@ -29,13 +29,14 @@ from .analytics_charts import (
29
  create_comparison_radar
30
  )
31
 
 
 
 
 
 
 
32
  # Additional components (to be added)
33
  # from .thought_graph import create_thought_graph
34
- # from .report_cards import (
35
- # generate_leaderboard_summary_card,
36
- # generate_run_report_card,
37
- # download_card_as_png_js
38
- # )
39
 
40
  __all__ = [
41
  'get_rank_badge',
@@ -55,4 +56,7 @@ __all__ = [
55
  'create_speed_accuracy_scatter',
56
  'create_cost_efficiency_scatter',
57
  'create_comparison_radar',
 
 
 
58
  ]
 
29
  create_comparison_radar
30
  )
31
 
32
+ from .report_cards import (
33
+ generate_leaderboard_summary_card,
34
+ generate_run_report_card,
35
+ download_card_as_png_js
36
+ )
37
+
38
  # Additional components (to be added)
39
  # from .thought_graph import create_thought_graph
 
 
 
 
 
40
 
41
  __all__ = [
42
  'get_rank_badge',
 
56
  'create_speed_accuracy_scatter',
57
  'create_cost_efficiency_scatter',
58
  'create_comparison_radar',
59
+ 'generate_leaderboard_summary_card',
60
+ 'generate_run_report_card',
61
+ 'download_card_as_png_js',
62
  ]
components/report_cards.py ADDED
@@ -0,0 +1,593 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Report Cards Component
3
+ Generate downloadable summary cards for leaderboard and runs
4
+ """
5
+
6
+ import pandas as pd
7
+ from datetime import datetime
8
+ from typing import Optional
9
+ import base64
10
+ from pathlib import Path
11
+
12
+
13
+ def _get_logo_base64():
14
+ """Load and encode TraceMind logo as base64"""
15
+ try:
16
+ logo_path = Path(__file__).parent.parent / "Logo.png"
17
+ if logo_path.exists():
18
+ with open(logo_path, "rb") as f:
19
+ return base64.b64encode(f.read()).decode()
20
+ except Exception as e:
21
+ print(f"Warning: Could not load logo: {e}")
22
+ return None
23
+
24
+
25
+ def generate_leaderboard_summary_card(df: pd.DataFrame, top_n: int = 3) -> str:
26
+ """
27
+ Generate HTML for leaderboard summary card
28
+
29
+ Args:
30
+ df: Leaderboard DataFrame
31
+ top_n: Number of top performers to show
32
+
33
+ Returns:
34
+ HTML string for summary card
35
+ """
36
+
37
+ if df.empty:
38
+ return _create_empty_card_html("No leaderboard data available")
39
+
40
+ # Get top performers by success rate
41
+ top_models = df.nlargest(top_n, 'success_rate') if 'success_rate' in df.columns else df.head(top_n)
42
+
43
+ # Get logo
44
+ logo_base64 = _get_logo_base64()
45
+
46
+ # Card header
47
+ html = f"""
48
+ <div class="tracemind-summary-card" id="summary-card-html">
49
+ <div class="card-header">
50
+ {f'<img src="data:image/png;base64,{logo_base64}" alt="TraceMind Logo" class="card-logo" style="display: block !important; margin: 0 auto 15px auto !important; width: 120px !important; height: auto !important;" />' if logo_base64 else ''}
51
+ <h1>🧠 TraceMind Agent Evaluation Leaderboard</h1>
52
+ <p class="card-date" style="color: #ffffff !important;">Generated: {datetime.now().strftime('%Y-%m-%d %H:%M')}</p>
53
+ </div>
54
+
55
+ <div class="card-body">
56
+ <h2 style="color: #ffffff !important;">🏆 Top Performers</h2>
57
+ """
58
+
59
+ # Top models
60
+ medals = ["🥇", "🥈", "🥉", "4️⃣", "5️⃣"]
61
+ for idx, (_, row) in enumerate(top_models.iterrows()):
62
+ if idx >= top_n:
63
+ break
64
+
65
+ model_name = row['model'].split('/')[-1] if '/' in str(row['model']) else str(row['model'])
66
+
67
+ html += f"""
68
+ <div class="top-model">
69
+ <div class="model-rank">{medals[idx]}</div>
70
+ <div class="model-info">
71
+ <h3 style="color: #ffffff !important;">{model_name}</h3>
72
+ <div class="model-metrics">
73
+ """
74
+
75
+ # Add metrics
76
+ if 'success_rate' in row and pd.notna(row['success_rate']):
77
+ html += f'<span class="metric" style="color: #ffffff !important;">✓ {row["success_rate"]:.1f}% Success Rate</span>'
78
+
79
+ if 'avg_duration_ms' in row and pd.notna(row['avg_duration_ms']):
80
+ duration_s = row['avg_duration_ms'] / 1000
81
+ html += f'<span class="metric" style="color: #ffffff !important;">⚡ {duration_s:.1f}s Avg Duration</span>'
82
+
83
+ if 'total_cost_usd' in row and pd.notna(row['total_cost_usd']):
84
+ html += f'<span class="metric" style="color: #ffffff !important;">💰 ${row["total_cost_usd"]:.4f} per run</span>'
85
+
86
+ # Add GPU metrics if available
87
+ if 'co2_emissions_g' in row and pd.notna(row['co2_emissions_g']):
88
+ html += f'<span class="metric" style="color: #ffffff !important;">🌱 {row["co2_emissions_g"]:.2f}g CO2</span>'
89
+
90
+ if 'gpu_utilization_avg' in row and pd.notna(row['gpu_utilization_avg']):
91
+ html += f'<span class="metric" style="color: #ffffff !important;">🎮 {row["gpu_utilization_avg"]:.1f}% GPU Util</span>'
92
+
93
+ html += """
94
+ </div>
95
+ </div>
96
+ </div>
97
+ """
98
+
99
+ # Aggregate stats
100
+ total_runs = len(df)
101
+ unique_models = df['model'].nunique() if 'model' in df.columns else 0
102
+ avg_success = df['success_rate'].mean() if 'success_rate' in df.columns else 0
103
+
104
+ html += f"""
105
+ <div class="card-stats">
106
+ <h2 style="color: #ffffff !important;">📊 Leaderboard Stats</h2>
107
+ <ul>
108
+ <li style="color: #ffffff !important;">• {total_runs} total evaluation runs</li>
109
+ <li style="color: #ffffff !important;">• {unique_models} unique models tested</li>
110
+ <li style="color: #ffffff !important;">• {avg_success:.1f}% average success rate</li>
111
+ """
112
+
113
+ # Add cost stats if available
114
+ if 'total_cost_usd' in df.columns:
115
+ total_cost = df['total_cost_usd'].sum()
116
+ html += f'<li style="color: #ffffff !important;">• ${total_cost:.2f} total evaluation cost</li>'
117
+
118
+ # Add CO2 stats if available
119
+ if 'co2_emissions_g' in df.columns:
120
+ total_co2 = df['co2_emissions_g'].sum()
121
+ html += f'<li style="color: #ffffff !important;">• {total_co2:.2f}g total CO2 emissions</li>'
122
+
123
+ html += """
124
+ </ul>
125
+ </div>
126
+ </div>
127
+
128
+ <div class="card-footer">
129
+ <p style="margin: 0; color: #ffffff !important;">🔗 <a href="https://huggingface.co/tracemind" style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; text-decoration: none; font-weight: 600;">tracemind @ HuggingFace</a></p>
130
+ <p class="tagline" style="color: rgba(255, 255, 255, 0.7) !important; margin: 10px 0 0 0; font-size: 0.9em;">Built with TraceMind • Powered by SmolTrace & TraceVerde</p>
131
+ </div>
132
+ </div>
133
+ """
134
+
135
+ # Add CSS
136
+ html += _get_card_css()
137
+
138
+ return html
139
+
140
+
141
+ def generate_run_report_card(run_data: dict) -> str:
142
+ """
143
+ Generate HTML for individual run report card
144
+
145
+ Args:
146
+ run_data: Dictionary with run information
147
+
148
+ Returns:
149
+ HTML string for run report card
150
+ """
151
+
152
+ if not run_data:
153
+ return _create_empty_card_html("No run data available")
154
+
155
+ model_name = run_data.get('model', 'Unknown Model')
156
+ model_display = model_name.split('/')[-1] if '/' in model_name else model_name
157
+
158
+ run_id = run_data.get('run_id', 'unknown')
159
+ timestamp = run_data.get('timestamp', datetime.now().strftime('%Y-%m-%d %H:%M'))
160
+
161
+ # Get logo
162
+ logo_base64 = _get_logo_base64()
163
+
164
+ html = f"""
165
+ <div class="tracemind-run-card" id="run-card-html">
166
+ <div class="card-header">
167
+ {f'<img src="data:image/png;base64,{logo_base64}" alt="TraceMind Logo" class="card-logo" style="display: block !important; margin: 0 auto 15px auto !important; width: 120px !important; height: auto !important;" />' if logo_base64 else ''}
168
+ <h1>🤖 {model_display} Evaluation Report</h1>
169
+ <p class="card-meta" style="color: rgba(255, 255, 255, 0.7) !important;">Run ID: {run_id}</p>
170
+ <p class="card-date" style="color: rgba(255, 255, 255, 0.7) !important;">{timestamp}</p>
171
+ </div>
172
+
173
+ <div class="card-body">
174
+ """
175
+
176
+ # Success rate visualization
177
+ success_rate = run_data.get('success_rate', 0)
178
+ stars = "⭐" * int(success_rate / 20) # 5 stars max
179
+
180
+ html += f"""
181
+ <div class="success-section">
182
+ <div class="stars">{stars}</div>
183
+ <div class="success-rate" style="color: #ffffff !important;">{success_rate:.1f}% Success Rate</div>
184
+ </div>
185
+ """
186
+
187
+ # Performance metrics
188
+ html += """
189
+ <div class="metrics-section">
190
+ <h2 style="color: #ffffff !important;">📊 Performance Metrics</h2>
191
+ <ul class="metrics-list">
192
+ """
193
+
194
+ if 'successful_tests' in run_data and 'total_tests' in run_data:
195
+ html += f'<li style="color: #ffffff !important;">Tests: {run_data["successful_tests"]}/{run_data["total_tests"]} passed</li>'
196
+
197
+ if 'avg_steps' in run_data:
198
+ html += f'<li style="color: #ffffff !important;">Avg Steps: {run_data["avg_steps"]:.1f} per test</li>'
199
+
200
+ if 'avg_duration_ms' in run_data:
201
+ duration_s = run_data['avg_duration_ms'] / 1000
202
+ html += f'<li style="color: #ffffff !important;">Avg Duration: {duration_s:.1f}s</li>'
203
+
204
+ if 'total_duration_ms' in run_data:
205
+ total_duration = run_data['total_duration_ms'] / 1000
206
+ mins = int(total_duration // 60)
207
+ secs = int(total_duration % 60)
208
+ html += f'<li style="color: #ffffff !important;">Total Duration: {mins}m {secs}s</li>'
209
+
210
+ html += """
211
+ </ul>
212
+ </div>
213
+ """
214
+
215
+ # Cost analysis
216
+ if 'total_tokens' in run_data or 'total_cost_usd' in run_data:
217
+ html += """
218
+ <div class="metrics-section">
219
+ <h2 style="color: #ffffff !important;">💰 Cost Analysis</h2>
220
+ <ul class="metrics-list">
221
+ """
222
+
223
+ if 'total_tokens' in run_data:
224
+ html += f'<li style="color: #ffffff !important;">Total Tokens: {run_data["total_tokens"]:,}</li>'
225
+
226
+ if 'total_cost_usd' in run_data:
227
+ html += f'<li style="color: #ffffff !important;">Total Cost: ${run_data["total_cost_usd"]:.4f}</li>'
228
+
229
+ if 'avg_cost_per_test_usd' in run_data:
230
+ html += f'<li style="color: #ffffff !important;">Cost per Test: ${run_data["avg_cost_per_test_usd"]:.6f}</li>'
231
+
232
+ html += """
233
+ </ul>
234
+ </div>
235
+ """
236
+
237
+ # Sustainability
238
+ if 'co2_emissions_g' in run_data or 'provider' in run_data:
239
+ html += """
240
+ <div class="metrics-section">
241
+ <h2 style="color: #ffffff !important;">🌱 Sustainability</h2>
242
+ <ul class="metrics-list">
243
+ """
244
+
245
+ if 'co2_emissions_g' in run_data:
246
+ html += f'<li style="color: #ffffff !important;">CO2 Emissions: {run_data["co2_emissions_g"]:.2f}g</li>'
247
+
248
+ if 'provider' in run_data:
249
+ provider_label = "API" if run_data['provider'] == 'litellm' else "GPU"
250
+ html += f'<li style="color: #ffffff !important;">Provider: {run_data["provider"]} ({provider_label})</li>'
251
+
252
+ if 'gpu_utilization_avg' in run_data and pd.notna(run_data['gpu_utilization_avg']):
253
+ html += f'<li style="color: #ffffff !important;">GPU Utilization: {run_data["gpu_utilization_avg"]:.1f}%</li>'
254
+
255
+ html += """
256
+ </ul>
257
+ </div>
258
+ """
259
+
260
+ # Footer
261
+ html += f"""
262
+ </div>
263
+
264
+ <div class="card-footer">
265
+ <p style="margin: 0; color: #ffffff !important;">🔗 <span style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; font-weight: 600;">View detailed traces at tracemind.huggingface.co</span></p>
266
+ </div>
267
+ </div>
268
+ """
269
+
270
+ # Add CSS
271
+ html += _get_card_css()
272
+
273
+ return html
274
+
275
+
276
+ def download_card_as_png_js(element_id: str = "summary-card-html") -> str:
277
+ """
278
+ JavaScript to convert HTML card to PNG using html2canvas
279
+
280
+ Args:
281
+ element_id: ID of the HTML element to capture
282
+
283
+ Returns:
284
+ JavaScript code as string
285
+ """
286
+
287
+ return f"""
288
+ () => {{
289
+ // Load html2canvas from CDN if not already loaded
290
+ if (typeof html2canvas === 'undefined') {{
291
+ const script = document.createElement('script');
292
+ script.src = 'https://cdn.jsdelivr.net/npm/[email protected]/dist/html2canvas.min.js';
293
+ script.onload = captureCard;
294
+ document.head.appendChild(script);
295
+ }} else {{
296
+ captureCard();
297
+ }}
298
+
299
+ function captureCard() {{
300
+ console.log('Searching for card element...');
301
+
302
+ // Try multiple strategies to find the card
303
+ let card = document.getElementById('{element_id}');
304
+
305
+ if (!card) {{
306
+ console.log('ID not found, trying class selector...');
307
+ card = document.querySelector('.tracemind-run-card');
308
+ }}
309
+
310
+ if (!card) {{
311
+ console.log('Class not found, trying summary-card-html...');
312
+ card = document.getElementById('summary-card-html');
313
+ }}
314
+
315
+ if (!card) {{
316
+ console.log('Still not found, searching all elements with tracemind in class...');
317
+ const cards = document.querySelectorAll('[class*="tracemind"]');
318
+ console.log('Found elements:', cards.length);
319
+ cards.forEach((el, i) => console.log(`Card ${{i}}:`, el.className, el.id));
320
+ if (cards.length > 0) {{
321
+ card = cards[0];
322
+ }}
323
+ }}
324
+
325
+ if (!card) {{
326
+ console.error('Card element not found anywhere!');
327
+ console.log('All IDs on page:', Array.from(document.querySelectorAll('[id]')).map(el => el.id));
328
+ alert('Card element not found. Please make sure you selected a run first.');
329
+ return;
330
+ }}
331
+
332
+ console.log('Found card:', card);
333
+ console.log('Card content length:', card.innerHTML?.length || 0);
334
+
335
+ // Clone the card to avoid modifying the original
336
+ const cardClone = card.cloneNode(true);
337
+ cardClone.style.position = 'absolute';
338
+ cardClone.style.left = '-9999px';
339
+ cardClone.style.top = '0';
340
+ document.body.appendChild(cardClone);
341
+
342
+ // Force all text elements to white in the clone
343
+ const textElements = cardClone.querySelectorAll('h1, h2, h3, p, li, span, a, div');
344
+ textElements.forEach(el => {{
345
+ // Skip elements with gradient text (background-clip: text)
346
+ const computedStyle = window.getComputedStyle(el);
347
+ const hasGradientText = computedStyle.webkitBackgroundClip === 'text' ||
348
+ computedStyle.backgroundClip === 'text' ||
349
+ el.style.webkitBackgroundClip === 'text' ||
350
+ el.style.backgroundClip === 'text';
351
+
352
+ if (!hasGradientText) {{
353
+ el.style.color = '#ffffff';
354
+ el.style.setProperty('color', '#ffffff', 'important');
355
+ }}
356
+ }});
357
+
358
+ // Ensure background is black
359
+ cardClone.style.backgroundColor = '#000000';
360
+ cardClone.style.setProperty('background-color', '#000000', 'important');
361
+
362
+ html2canvas(cardClone, {{
363
+ backgroundColor: '#000000',
364
+ scale: 2,
365
+ logging: false,
366
+ useCORS: true,
367
+ allowTaint: true
368
+ }}).then(canvas => {{
369
+ // Remove the clone
370
+ document.body.removeChild(cardClone);
371
+
372
+ console.log('Canvas size:', canvas.width, 'x', canvas.height);
373
+ const link = document.createElement('a');
374
+ const timestamp = new Date().toISOString().slice(0, 10);
375
+ link.download = `tracemind-report-${{timestamp}}.png`;
376
+ link.href = canvas.toDataURL('image/png');
377
+ link.click();
378
+ }}).catch(err => {{
379
+ // Remove the clone on error
380
+ if (document.body.contains(cardClone)) {{
381
+ document.body.removeChild(cardClone);
382
+ }}
383
+ console.error('Error capturing card:', err);
384
+ alert('Failed to download card: ' + err.message);
385
+ }});
386
+ }}
387
+ }}
388
+ """
389
+
390
+
391
+ def _create_empty_card_html(message: str) -> str:
392
+ """Create empty card with message"""
393
+ return f"""
394
+ <div class="tracemind-summary-card" id="summary-card-html">
395
+ <div class="card-body" style="text-align: center; padding: 40px;">
396
+ <p style="color: #666; font-size: 1.2em;">{message}</p>
397
+ </div>
398
+ </div>
399
+ {_get_card_css()}
400
+ """
401
+
402
+
403
+ def _get_card_css() -> str:
404
+ """Get CSS for summary cards"""
405
+ return """
406
+ <style>
407
+ .tracemind-summary-card, .tracemind-run-card {
408
+ background: #000000 !important;
409
+ border: 3px solid #667eea;
410
+ border-radius: 24px;
411
+ padding: 40px;
412
+ max-width: 700px;
413
+ margin: 20px auto;
414
+ color: #ffffff !important;
415
+ font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
416
+ box-shadow: 0 10px 30px rgba(0,0,0,0.5);
417
+ }
418
+
419
+ .card-header {
420
+ text-align: center;
421
+ border-bottom: 2px solid rgba(255, 255, 255, 0.1);
422
+ padding-bottom: 20px;
423
+ margin-bottom: 30px;
424
+ }
425
+
426
+ .card-logo {
427
+ width: 120px;
428
+ height: auto;
429
+ margin: 0 auto 15px auto;
430
+ display: block;
431
+ filter: brightness(1.1);
432
+ }
433
+
434
+ .card-header h1 {
435
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
436
+ -webkit-background-clip: text;
437
+ -webkit-text-fill-color: transparent;
438
+ background-clip: text;
439
+ font-size: 2em;
440
+ margin: 0 0 10px 0;
441
+ font-weight: bold;
442
+ }
443
+
444
+ .card-date, .card-meta {
445
+ color: rgba(255, 255, 255, 0.7) !important;
446
+ font-size: 0.9em;
447
+ margin: 5px 0;
448
+ }
449
+
450
+ .card-body {
451
+ padding: 0;
452
+ }
453
+
454
+ .card-body h2 {
455
+ color: #ffffff !important;
456
+ font-size: 1.4em;
457
+ margin: 25px 0 15px 0;
458
+ font-weight: 600;
459
+ }
460
+
461
+ .top-model {
462
+ display: flex;
463
+ gap: 16px;
464
+ align-items: flex-start;
465
+ margin: 20px 0;
466
+ padding: 20px;
467
+ background: rgba(255, 255, 255, 0.05);
468
+ border-radius: 12px;
469
+ border-left: 4px solid #667eea;
470
+ transition: transform 0.2s, box-shadow 0.2s;
471
+ }
472
+
473
+ .top-model:hover {
474
+ transform: translateX(5px);
475
+ box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
476
+ }
477
+
478
+ .model-rank {
479
+ font-size: 2.5rem;
480
+ line-height: 1;
481
+ }
482
+
483
+ .model-info {
484
+ flex: 1;
485
+ }
486
+
487
+ .model-info h3 {
488
+ color: #ffffff !important;
489
+ margin: 0 0 10px 0;
490
+ font-size: 1.2em;
491
+ font-weight: 600;
492
+ }
493
+
494
+ .model-metrics {
495
+ display: flex;
496
+ flex-direction: column;
497
+ gap: 6px;
498
+ }
499
+
500
+ .model-metrics .metric, .model-metrics span {
501
+ font-size: 0.95em;
502
+ color: #ffffff !important;
503
+ line-height: 1.4;
504
+ }
505
+
506
+ .success-section {
507
+ text-align: center;
508
+ margin: 30px 0;
509
+ padding: 20px;
510
+ background: rgba(255, 255, 255, 0.05);
511
+ border-radius: 12px;
512
+ }
513
+
514
+ .stars {
515
+ font-size: 2.5em;
516
+ margin-bottom: 10px;
517
+ }
518
+
519
+ .success-rate {
520
+ font-size: 2em;
521
+ font-weight: bold;
522
+ color: #ffffff !important;
523
+ }
524
+
525
+ .metrics-section {
526
+ margin: 25px 0;
527
+ }
528
+
529
+ .metrics-list {
530
+ list-style: none;
531
+ padding: 0;
532
+ margin: 0;
533
+ }
534
+
535
+ .metrics-list li {
536
+ padding: 10px 0;
537
+ color: #ffffff !important;
538
+ font-size: 1em;
539
+ border-bottom: 1px solid rgba(255, 255, 255, 0.1);
540
+ }
541
+
542
+ .metrics-list li:last-child {
543
+ border-bottom: none;
544
+ }
545
+
546
+ .card-stats {
547
+ margin-top: 35px;
548
+ padding-top: 25px;
549
+ border-top: 2px solid rgba(255, 255, 255, 0.2);
550
+ }
551
+
552
+ .card-stats ul {
553
+ list-style: none;
554
+ padding: 0;
555
+ margin: 15px 0 0 0;
556
+ }
557
+
558
+ .card-stats li {
559
+ color: #ffffff !important;
560
+ font-size: 1em;
561
+ padding: 8px 0;
562
+ line-height: 1.6;
563
+ }
564
+
565
+ .card-footer {
566
+ margin-top: 35px;
567
+ text-align: center;
568
+ padding-top: 25px;
569
+ border-top: 2px solid rgba(255, 255, 255, 0.2);
570
+ }
571
+
572
+ .card-footer a {
573
+ color: #ffffff !important;
574
+ text-decoration: none;
575
+ font-weight: 600;
576
+ transition: opacity 0.2s;
577
+ }
578
+
579
+ .card-footer a:hover {
580
+ opacity: 0.8;
581
+ }
582
+
583
+ .card-footer p {
584
+ color: #ffffff !important;
585
+ }
586
+
587
+ .tagline {
588
+ color: rgba(255, 255, 255, 0.7) !important;
589
+ font-size: 0.9em;
590
+ margin: 10px 0 0 0;
591
+ }
592
+ </style>
593
+ """