dvilasuero HF Staff commited on
Commit
c2dc347
·
verified ·
1 Parent(s): e928772

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +304 -18
index.html CHANGED
@@ -1,19 +1,305 @@
1
- <!doctype html>
2
  <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
  <html>
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Live WebApp Viewer</title>
6
+ <style>
7
+ body { margin: 0; font-family: Arial, sans-serif; background: #f5f5f5; }
8
+ .container { width: 100vw; padding: 10px; box-sizing: border-box; }
9
+ .loading { text-align: center; padding: 50px; font-size: 18px; color: #666; }
10
+ .main-title {
11
+ text-align: center;
12
+ margin-bottom: 20px;
13
+ padding: 0 20px;
14
+ }
15
+ .main-title h1 {
16
+ font-size: 48px;
17
+ font-weight: 800;
18
+ margin: 0 0 8px 0;
19
+ letter-spacing: -1px;
20
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
21
+ -webkit-background-clip: text;
22
+ -webkit-text-fill-color: transparent;
23
+ background-clip: text;
24
+ }
25
+ .main-title p {
26
+ font-size: 20px;
27
+ margin: 0;
28
+ color: #666;
29
+ font-weight: 400;
30
+ line-height: 1.4;
31
+ }
32
+ .stats-header {
33
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
34
+ color: white;
35
+ padding: 30px 20px;
36
+ text-align: center;
37
+ margin-bottom: 30px;
38
+ border-radius: 12px;
39
+ box-shadow: 0 8px 32px rgba(0,0,0,0.1);
40
+ }
41
+ .stats-header p {
42
+ font-size: 16px;
43
+ margin: 0 0 20px 0;
44
+ opacity: 0.9;
45
+ font-weight: 400;
46
+ line-height: 1.5;
47
+ }
48
+ .win-stats {
49
+ display: flex;
50
+ justify-content: center;
51
+ gap: 50px;
52
+ margin-top: 20px;
53
+ flex-wrap: wrap;
54
+ }
55
+ .stat {
56
+ font-size: 16px;
57
+ background: rgba(255,255,255,0.15);
58
+ padding: 12px 20px;
59
+ border-radius: 8px;
60
+ backdrop-filter: blur(10px);
61
+ border: 1px solid rgba(255,255,255,0.2);
62
+ }
63
+ .stat .model {
64
+ font-weight: 600;
65
+ display: block;
66
+ margin-bottom: 4px;
67
+ }
68
+ .stat .wins {
69
+ color: #4ade80;
70
+ font-weight: 700;
71
+ font-size: 18px;
72
+ }
73
+ .app-section { margin-bottom: 30px; background: white; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); overflow: hidden; }
74
+ .description-header {
75
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
76
+ color: white;
77
+ padding: 20px 15px;
78
+ text-align: center;
79
+ font-size: 18px;
80
+ font-weight: 600;
81
+ letter-spacing: -0.3px;
82
+ }
83
+ .evaluation-section { background: #f8f9fa; border-bottom: 1px solid #eee; padding: 15px; }
84
+ .evaluation-result { background: #d4edda; border: 1px solid #c3e6cb; border-radius: 4px; padding: 12px; margin-bottom: 10px; }
85
+ .eval-label { font-size: 12px; color: #666; margin-bottom: 5px; }
86
+ .winner { color: #155724; font-weight: bold; margin-bottom: 5px; }
87
+ .reason { color: #155724; }
88
+ .view-eval-btn { background: #007bff; color: white; border: none; padding: 5px 10px; border-radius: 3px; cursor: pointer; margin-top: 10px; font-size: 12px; }
89
+ .full-evaluation { background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 4px; padding: 15px; margin-top: 10px; display: none; }
90
+ .thinking-content { max-height: 300px; overflow-y: auto; font-size: 14px; line-height: 1.5; white-space: pre-wrap; text-align: left; color: #495057; }
91
+ .implementations { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
92
+ .impl-panel { border-right: 1px solid #eee; }
93
+ .impl-panel:last-child { border-right: none; }
94
+ .impl-header {
95
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
96
+ color: white;
97
+ padding: 12px 15px;
98
+ font-weight: 600;
99
+ text-align: center;
100
+ font-size: 15px;
101
+ letter-spacing: -0.2px;
102
+ }
103
+ .iframe-container { height: 600px; }
104
+ iframe { width: 100%; height: 100%; border: none; transform: scale(1); transform-origin: top left; }
105
+ .error { color: red; text-align: center; padding: 20px; }
106
+ /* Large screens - even bigger */
107
+ @media (min-width: 1400px) {
108
+ .iframe-container { height: 700px; }
109
+ }
110
+
111
+ /* Medium screens */
112
+ @media (max-width: 1200px) {
113
+ .iframe-container { height: 500px; }
114
+ }
115
+
116
+ /* Small screens - stack vertically */
117
+ @media (max-width: 768px) {
118
+ .implementations { grid-template-columns: 1fr; }
119
+ .impl-panel { border-right: none; border-bottom: 1px solid #eee; }
120
+ .impl-panel:last-child { border-bottom: none; }
121
+ .iframe-container { height: 400px; }
122
+ .container { padding: 5px; }
123
+ .description-header { padding: 10px; font-size: 14px; }
124
+ }
125
+ </style>
126
+ </head>
127
+ <body>
128
+ <div class="container">
129
+ <div id="apps-container" class="loading">Loading apps from Hugging Face...</div>
130
+ </div>
131
+
132
+ <script>
133
+ function parseEvaluation(evalText) {
134
+ if (!evalText) return null;
135
+
136
+ try {
137
+ // Look for "chosen:" and "reason:" patterns
138
+ const chosenMatch = evalText.match(/chosen:\s*(.+?)(?:\n|$)/i);
139
+ const reasonMatch = evalText.match(/reason:\s*(.+?)(?:\n|$)/is);
140
+
141
+ if (chosenMatch) {
142
+ return {
143
+ winner: chosenMatch[1].trim(),
144
+ reason: reasonMatch ? reasonMatch[1].trim() : '',
145
+ fullEval: evalText
146
+ };
147
+ }
148
+
149
+ return null;
150
+ } catch (e) {
151
+ console.error('Error parsing evaluation:', e);
152
+ return null;
153
+ }
154
+ }
155
+
156
+ function createEvaluationSection(evaluation, index) {
157
+ const winner = evaluation.winner.toLowerCase().includes('kimi') ? 'Kimi-K2' :
158
+ evaluation.winner.toLowerCase().includes('qwen') ? 'Qwen3-Coder' :
159
+ evaluation.winner;
160
+
161
+ return `
162
+ <div class="evaluation-section">
163
+ <div class="eval-label">(Kimi-K2 judge)</div>
164
+ <div class="evaluation-result">
165
+ <div class="winner">🏆 Winner: ${winner}</div>
166
+ <button class="view-eval-btn" onclick="toggleFullEval(${index})">View Reason</button>
167
+ </div>
168
+ <div class="full-evaluation" id="full-eval-${index}">
169
+ <div class="thinking-content">${evaluation.reason}</div>
170
+ </div>
171
+ </div>
172
+ `;
173
+ }
174
+
175
+ function calculateWinRates(rows) {
176
+ let kimiWins = 0;
177
+ let qwenWins = 0;
178
+ let ties = 0;
179
+ let totalEvaluated = 0;
180
+
181
+ rows.forEach(row => {
182
+ const evaluation = parseEvaluation(row.row['r1-evaluation'] || '');
183
+ if (evaluation) {
184
+ totalEvaluated++;
185
+ const winner = evaluation.winner.toLowerCase();
186
+ if (winner.includes('kimi')) {
187
+ kimiWins++;
188
+ } else if (winner.includes('qwen')) {
189
+ qwenWins++;
190
+ } else {
191
+ ties++;
192
+ }
193
+ }
194
+ });
195
+
196
+ const kimiRate = totalEvaluated > 0 ? Math.round((kimiWins / totalEvaluated) * 100) : 0;
197
+ const qwenRate = totalEvaluated > 0 ? Math.round((qwenWins / totalEvaluated) * 100) : 0;
198
+
199
+ return {
200
+ kimi: kimiWins,
201
+ qwen: qwenWins,
202
+ ties: ties,
203
+ kimiRate: kimiRate,
204
+ qwenRate: qwenRate,
205
+ total: totalEvaluated
206
+ };
207
+ }
208
+
209
+ function toggleFullEval(index) {
210
+ const fullEval = document.getElementById(`full-eval-${index}`);
211
+
212
+ if (fullEval.style.display === 'block') {
213
+ fullEval.style.display = 'none';
214
+ } else {
215
+ fullEval.style.display = 'block';
216
+ }
217
+ }
218
+
219
+ async function loadAppsFromHuggingFace() {
220
+ const container = document.getElementById('apps-container');
221
+
222
+ const response = await fetch('https://datasets-server.huggingface.co/rows?dataset=dvilasuero/JSVibes&config=default&split=train&offset=0&length=50');
223
+ const data = await response.json();
224
+
225
+ // Calculate win rates
226
+ const winStats = calculateWinRates(data.rows);
227
+
228
+ container.innerHTML = `
229
+ <div class="main-title">
230
+ <h1>JSVibes</h1>
231
+ <p>Vibe testing open models for simple but useful code tasks</p>
232
+ </div>
233
+ <div class="stats-header">
234
+ <p style="font-size: 14px; opacity: 0.8;">Automatically evaluated by Kimi K2 as a judge. Judgments are imperfect, test them yourself!</p>
235
+ <div class="win-stats">
236
+ <div class="stat">
237
+ <span class="model">Kimi-K2</span>
238
+ <span class="wins">${winStats.kimi} wins</span>
239
+ <div style="font-size: 14px; opacity: 0.8;">${winStats.kimiRate}%</div>
240
+ </div>
241
+ <div class="stat">
242
+ <span class="model">Qwen3-Coder</span>
243
+ <span class="wins">${winStats.qwen} wins</span>
244
+ <div style="font-size: 14px; opacity: 0.8;">${winStats.qwenRate}%</div>
245
+ </div>
246
+ <div class="stat">
247
+ <span class="model">Ties</span>
248
+ <span class="wins">${winStats.ties}</span>
249
+ </div>
250
+ </div>
251
+ </div>
252
+ `;
253
+
254
+ data.rows.forEach((row, index) => {
255
+ const app = row.row;
256
+
257
+ // Clean HTML content by removing markdown code blocks
258
+ let kimiHtml = app['kimi-k2'] || '';
259
+ let qwenHtml = app['qwen3-coder'] || '';
260
+
261
+ if (kimiHtml.startsWith('```html')) {
262
+ kimiHtml = kimiHtml.replace(/```html\n?/, '').replace(/```$/, '');
263
+ }
264
+ if (qwenHtml.startsWith('```html')) {
265
+ qwenHtml = qwenHtml.replace(/```html\n?/, '').replace(/```$/, '');
266
+ }
267
+
268
+ // Parse evaluation data
269
+ const evaluation = parseEvaluation(app['r1-evaluation'] || '');
270
+ if (!evaluation && app['r1-evaluation']) {
271
+ console.log(`Failed to parse evaluation for app ${index}:`, app['r1-evaluation']);
272
+ }
273
+
274
+ const section = document.createElement('div');
275
+ section.className = 'app-section';
276
+ section.innerHTML = `
277
+ <div class="description-header">
278
+ ${index + 1}. ${app.description || 'No description available'}
279
+ </div>
280
+ ${evaluation ? createEvaluationSection(evaluation, index) : ''}
281
+ <div class="implementations">
282
+ <div class="impl-panel">
283
+ <div class="impl-header">Kimi-K2</div>
284
+ <div class="iframe-container">
285
+ <iframe srcdoc="${kimiHtml.replace(/"/g, '&quot;')}"></iframe>
286
+ </div>
287
+ </div>
288
+ <div class="impl-panel">
289
+ <div class="impl-header">Qwen3-Coder</div>
290
+ <div class="iframe-container">
291
+ <iframe srcdoc="${qwenHtml.replace(/"/g, '&quot;')}"></iframe>
292
+ </div>
293
+ </div>
294
+ </div>
295
+ `;
296
+
297
+ container.appendChild(section);
298
+ });
299
+ }
300
+
301
+ // Load apps when page loads
302
+ loadAppsFromHuggingFace();
303
+ </script>
304
+ </body>
305
+ </html>