AyushMann29 commited on
Commit
7d3b013
·
verified ·
1 Parent(s): 683a8c7

Upload index.html

Browse files
Files changed (1) hide show
  1. index.html +417 -0
index.html ADDED
@@ -0,0 +1,417 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Nova: Loan Eligibility Checker</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <style>
9
+ body {
10
+ font-family: 'Inter', sans-serif;
11
+ background-color: #f3f4f6;
12
+ }
13
+ .table-auto {
14
+ table-layout: auto;
15
+ }
16
+ </style>
17
+ </head>
18
+ <body class="bg-gray-100 min-h-screen flex items-center justify-center p-4">
19
+ <div class="bg-white rounded-xl shadow-xl p-8 max-w-4xl w-full">
20
+ <header class="text-center mb-8">
21
+ <h1 class="text-4xl font-bold text-gray-800">Nova: Loan Eligibility Checker</h1>
22
+ <p class="text-gray-600 mt-2">Enter your data to check your loan eligibility.</p>
23
+ </header>
24
+
25
+ <section id="metrics-section" class="bg-gray-50 rounded-lg p-6 mb-8 border border-gray-200 hidden">
26
+ <h2 class="text-xl font-semibold text-gray-700 mb-4">Model Performance Metrics</h2>
27
+ <div id="metrics-data" class="grid grid-cols-1 sm:grid-cols-2 gap-4 text-gray-700">
28
+ </div>
29
+ <p class="text-xs text-gray-500 mt-4">
30
+ These metrics represent the model's performance on a historical dataset.
31
+ </p>
32
+ </section>
33
+
34
+ <div class="mb-8">
35
+ <div class="flex border-b border-gray-200">
36
+ <button id="tab-single" class="tab-button py-2 px-4 text-sm font-medium border-b-2 border-blue-600 text-blue-600 transition-colors duration-200">Single Entry</button>
37
+ <button id="tab-csv" class="tab-button py-2 px-4 text-sm font-medium border-b-2 border-transparent text-gray-500 hover:text-gray-700 transition-colors duration-200">Upload CSV</button>
38
+ </div>
39
+ </div>
40
+
41
+ <div id="csv-results-container" class="hidden">
42
+ <section id="fairness-section" class="bg-gray-50 rounded-lg p-6 mb-8 border border-gray-200 hidden">
43
+ <h2 class="text-xl font-semibold text-gray-700 mb-4">Fairness Metrics by Group</h2>
44
+ <div id="fairness-table" class="mb-6"></div>
45
+ <canvas id="fairness-chart" height="200"></canvas>
46
+ <div id="fairness-observation" class="mt-4 text-gray-700 font-medium"></div>
47
+ </section>
48
+
49
+ <section id="csv-results-table" class="mt-6 hidden">
50
+ </section>
51
+ </div>
52
+
53
+ <section id="single-entry-form" class="space-y-6">
54
+ <h2 class="text-xl font-semibold text-gray-700 mb-4">Your Information</h2>
55
+ <form id="loan-form" class="space-y-6">
56
+ <div>
57
+ <label for="partnerType" class="block text-sm font-medium text-gray-700 mb-1">Partner Type</label>
58
+ <select id="partnerType" name="Partner Type" required class="mt-1 block w-full rounded-md border-gray-300 shadow-sm p-3 focus:border-indigo-500 focus:ring-indigo-500 border">
59
+ <option value="">Select a type...</option>
60
+ <option value="Merchant">Merchant</option>
61
+ <option value="Driver">Driver</option>
62
+ </select>
63
+ </div>
64
+ <div>
65
+ <label for="earningsValue" class="block text-sm font-medium text-gray-700 mb-1">Earnings (Value)</label>
66
+ <input type="number" id="earningsValue" name="Earnings (Value)" required min="0" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm p-3 focus:border-indigo-500 focus:ring-indigo-500 border">
67
+ </div>
68
+ <div>
69
+ <label for="earningsStability" class="block text-sm font-medium text-gray-700 mb-1">Earnings (Stability Type)</label>
70
+ <select id="earningsStability" name="Earnings (Stability Type)" required class="mt-1 block w-full rounded-md border-gray-300 shadow-sm p-3 focus:border-indigo-500 focus:ring-indigo-500 border">
71
+ <option value="">Select stability...</option>
72
+ <option value="Stable">Stable</option>
73
+ <option value="Variable">Variable</option>
74
+ <option value="Seasonal">Seasonal</option>
75
+ </select>
76
+ </div>
77
+ <div>
78
+ <label for="perfRating" class="block text-sm font-medium text-gray-700 mb-1">Performance Rating (Avg)</label>
79
+ <input type="number" id="perfRating" name="Perf. Rating (Avg)" required min="1" max="5" step="0.1" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm p-3 focus:border-indigo-500 focus:ring-indigo-500 border">
80
+ </div>
81
+ <div>
82
+ <label for="timeOnPlatform" class="block text-sm font-medium text-gray-700 mb-1">Time on Platform (Months)</label>
83
+ <input type="number" id="timeOnPlatform" name="Time on Platform (Months)" required min="0" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm p-3 focus:border-indigo-500 focus:ring-indigo-500 border">
84
+ </div>
85
+ <div>
86
+ <label for="volume" class="block text-sm font-medium text-gray-700 mb-1">Order/Trip Volume</label>
87
+ <input type="number" id="volume" name="Order/Trip Volume" required min="0" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm p-3 focus:border-indigo-500 focus:ring-indigo-500 border">
88
+ </div>
89
+ <div>
90
+ <label for="financialActivity" class="block text-sm font-medium text-gray-700 mb-1">Financial Activity (Score)</label>
91
+ <input type="number" id="financialActivity" name="Financial Activity (Score)" required min="0" max="1" step="0.1" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm p-3 focus:border-indigo-500 focus:ring-indigo-500 border">
92
+ </div>
93
+ <div>
94
+ <label for="earningsVolatility" class="block text-sm font-medium text-gray-700 mb-1">Earnings Volatility</label>
95
+ <input type="number" id="earningsVolatility" name="Earnings Volatility" required min="0" step="0.01" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm p-3 focus:border-indigo-500 focus:ring-indigo-500 border">
96
+ </div>
97
+ <div>
98
+ <label for="repayments" class="block text-sm font-medium text-gray-700 mb-1">On-Time Loan Repayments</label>
99
+ <input type="number" id="repayments" name="On-Time Loan Repayments" required min="0" step="1" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm p-3 focus:border-indigo-500 focus:ring-indigo-500 border">
100
+ </div>
101
+ <div>
102
+ <label for="anomalyScore" class="block text-sm font-medium text-gray-700 mb-1">Operational Anomaly Score</label>
103
+ <input type="number" id="anomalyScore" name="Operational Anomaly Score" required min="0" max="1" step="0.01" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm p-3 focus:border-indigo-500 focus:ring-indigo-500 border">
104
+ </div>
105
+
106
+ <button type="submit" class="w-full bg-blue-600 text-white font-semibold py-3 rounded-lg shadow-md hover:bg-blue-700 transition duration-300 ease-in-out transform hover:scale-105">
107
+ Check Eligibility
108
+ </button>
109
+ </form>
110
+ </section>
111
+
112
+ <section id="csv-upload-form" class="hidden">
113
+ <h2 class="text-xl font-semibold text-gray-700 mb-4">Upload a CSV File</h2>
114
+ <form id="csv-form" class="space-y-6">
115
+ <div>
116
+ <label for="csvFile" class="block text-sm font-medium text-gray-700 mb-1">Select CSV File</label>
117
+ <input type="file" id="csvFile" name="file" accept=".csv" required class="mt-1 block w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-blue-50 file:text-blue-700 hover:file:bg-blue-100">
118
+ </div>
119
+ <button type="submit" class="w-full bg-blue-600 text-white font-semibold py-3 rounded-lg shadow-md hover:bg-blue-700 transition duration-300 ease-in-out transform hover:scale-105">
120
+ Process CSV
121
+ </button>
122
+ </form>
123
+ </section>
124
+
125
+ <section id="result-section" class="mt-8">
126
+ <div id="prediction-result" class="p-6 text-center text-lg font-semibold rounded-lg hidden">
127
+ </div>
128
+ </section>
129
+ </div>
130
+
131
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
132
+ <script>
133
+ function displayFairnessMetrics(fairnessMetrics, fairnessObservation) {
134
+ const fairnessSection = document.getElementById('fairness-section');
135
+ const fairnessTable = document.getElementById('fairness-table');
136
+ const fairnessChart = document.getElementById('fairness-chart');
137
+ const fairnessObservationDiv = document.getElementById('fairness-observation');
138
+ if (!fairnessMetrics || !fairnessMetrics.selection_rate) {
139
+ fairnessSection.classList.add('hidden');
140
+ return;
141
+ }
142
+ // Show section
143
+ fairnessSection.classList.remove('hidden');
144
+ // Table
145
+ let html = `<table class="min-w-full table-auto divide-y divide-gray-200"><thead><tr><th class="px-4 py-2">Group</th><th class="px-4 py-2">Selection Rate</th><th class="px-4 py-2">Equal Opportunity</th></tr></thead><tbody>`;
146
+ const groups = Object.keys(fairnessMetrics.selection_rate);
147
+ groups.forEach(group => {
148
+ html += `<tr><td class="px-4 py-2">${group}</td><td class="px-4 py-2">${(fairnessMetrics.selection_rate[group]*100).toFixed(2)}%</td><td class="px-4 py-2">${(fairnessMetrics.equal_opportunity[group]*100).toFixed(2)}%</td></tr>`;
149
+ });
150
+ html += '</tbody></table>';
151
+ fairnessTable.innerHTML = html;
152
+ // Chart
153
+ const chartData = {
154
+ labels: groups,
155
+ datasets: [
156
+ {
157
+ label: 'Selection Rate',
158
+ data: groups.map(g => fairnessMetrics.selection_rate[g]),
159
+ backgroundColor: 'rgba(59,130,246,0.7)'
160
+ },
161
+ {
162
+ label: 'Equal Opportunity',
163
+ data: groups.map(g => fairnessMetrics.equal_opportunity[g]),
164
+ backgroundColor: 'rgba(16,185,129,0.7)'
165
+ }
166
+ ]
167
+ };
168
+ if (window.fairnessChartInstance) window.fairnessChartInstance.destroy();
169
+ window.fairnessChartInstance = new Chart(fairnessChart, {
170
+ type: 'bar',
171
+ data: chartData,
172
+ options: {
173
+ responsive: true,
174
+ plugins: { legend: { position: 'top' } },
175
+ scales: { y: { beginAtZero: true, max: 1 } }
176
+ }
177
+ });
178
+ // Observation
179
+ fairnessObservationDiv.textContent = fairnessObservation || '';
180
+ }
181
+ </script>
182
+ <script>
183
+ document.addEventListener('DOMContentLoaded', () => {
184
+ const tabSingle = document.getElementById('tab-single');
185
+ const tabCsv = document.getElementById('tab-csv');
186
+ const singleEntryForm = document.getElementById('single-entry-form');
187
+ const csvUploadForm = document.getElementById('csv-upload-form');
188
+ const form = document.getElementById('loan-form');
189
+ const csvForm = document.getElementById('csv-form');
190
+ const metricsSection = document.getElementById('metrics-section');
191
+ const metricsData = document.getElementById('metrics-data');
192
+ const predictionResult = document.getElementById('prediction-result');
193
+
194
+ // Get the new container and the elements inside it
195
+ const csvResultsContainer = document.getElementById('csv-results-container');
196
+ const csvResultsTable = document.getElementById('csv-results-table');
197
+ const fairnessSection = document.getElementById('fairness-section');
198
+
199
+ // Tab switching logic
200
+ tabSingle.addEventListener('click', () => {
201
+ tabSingle.classList.add('border-blue-600', 'text-blue-600');
202
+ tabCsv.classList.remove('border-blue-600', 'text-blue-600');
203
+ tabCsv.classList.add('border-transparent', 'text-gray-500', 'hover:text-gray-700');
204
+ singleEntryForm.classList.remove('hidden');
205
+ csvUploadForm.classList.add('hidden');
206
+ predictionResult.classList.add('hidden');
207
+ csvResultsContainer.classList.add('hidden'); // Hide the entire CSV container
208
+ fairnessSection.classList.add('hidden'); // Ensure fairness section is hidden
209
+ });
210
+
211
+ tabCsv.addEventListener('click', () => {
212
+ tabCsv.classList.add('border-blue-600', 'text-blue-600');
213
+ tabSingle.classList.remove('border-blue-600', 'text-blue-600');
214
+ tabSingle.classList.add('border-transparent', 'text-gray-500', 'hover:text-gray-700');
215
+ csvUploadForm.classList.remove('hidden');
216
+ singleEntryForm.classList.add('hidden');
217
+ predictionResult.classList.add('hidden');
218
+ // The container will be shown when results are ready
219
+ });
220
+
221
+ // Function to display the model metrics
222
+ function displayMetrics(metrics) {
223
+ metricsSection.classList.remove('hidden');
224
+ metricsData.innerHTML = `
225
+ <div class="flex items-center space-x-2">
226
+ <svg class="h-6 w-6 text-green-500" fill="currentColor" viewBox="0 0 20 20">
227
+ <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" />
228
+ </svg>
229
+ <p class="font-medium">Accuracy: <span class="text-blue-600">${(metrics.accuracy * 100).toFixed(2)}%</span></p>
230
+ </div>
231
+ <div class="flex items-center space-x-2">
232
+ <svg class="h-6 w-6 text-blue-500" fill="currentColor" viewBox="0 0 20 20">
233
+ <path d="M5 3a2 2 0 00-2 2v2a2 2 0 002 2h2a2 2 0 002-2V5a2 2 0 00-2-2H5zM11 3a2 2 0 00-2 2v2a2 2 0 002 2h2a2 2 0 002-2V5a2 2 0 00-2-2h-2zM11 9a2 2 0 00-2 2v2a2 2 0 002 2h2a2 2 0 002-2v-2a2 2 0 00-2-2h-2zM5 9a2 2 0 00-2 2v2a2 2 0 002 2h2a2 2 0 002-2v-2a2 2 0 00-2-2H5z" />
234
+ </svg>
235
+ <p class="font-medium">Precision: <span class="text-blue-600">${(metrics.precision * 100).toFixed(2)}%</span></p>
236
+ </div>
237
+ <div class="flex items-center space-x-2">
238
+ <svg class="h-6 w-6 text-indigo-500" fill="currentColor" viewBox="0 0 20 20">
239
+ <path d="M10 12a2 2 0 100-4 2 2 0 000 4z" />
240
+ <path fill-rule="evenodd" d="M.458 10C1.732 5.943 5.522 3 10 3s8.268 2.943 9.542 7c-1.274 4.057-5.064 7-9.542 7S1.732 14.057.458 10zM14 10a4 4 0 11-8 0 4 4 0 018 0z" clip-rule="evenodd" />
241
+ </svg>
242
+ <p class="font-medium">Recall: <span class="text-blue-600">${(metrics.recall * 100).toFixed(2)}%</span></p>
243
+ </div>
244
+ <div class="flex items-center space-x-2">
245
+ <svg class="h-6 w-6 text-purple-500" fill="currentColor" viewBox="0 0 20 20">
246
+ <path d="M3 12a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z" />
247
+ <path d="M10 3a1 1 0 011 1v12a1 1 0 11-2 0V4a1 1 0 011-1z" />
248
+ </svg>
249
+ <p class="font-medium">F1-Score: <span class="text-blue-600">${(metrics.f1_score * 100).toFixed(2)}%</span></p>
250
+ </div>
251
+ `;
252
+ }
253
+
254
+ // Add this helper function
255
+ function convertToNumbers(data) {
256
+ const numericKeys = [
257
+ "Earnings (Value)",
258
+ "Perf. Rating (Avg)",
259
+ "Time on Platform (Months)",
260
+ "Order/Trip Volume",
261
+ "Financial Activity (Score)",
262
+ "Earnings Volatility",
263
+ "On-Time Loan Repayments",
264
+ "Operational Anomaly Score"
265
+ ];
266
+
267
+ // Create a copy to avoid modifying the original data object
268
+ const newData = { ...data };
269
+
270
+ for (const key of numericKeys) {
271
+ if (newData[key] !== undefined) {
272
+ // Use parseFloat for decimals and parseInt for integers
273
+ if (key.includes("Score") || key.includes("Volatility") || key.includes("Rating")) {
274
+ newData[key] = parseFloat(newData[key]);
275
+ } else {
276
+ newData[key] = parseInt(newData[key], 10);
277
+ }
278
+ }
279
+ }
280
+ return newData;
281
+ }
282
+
283
+ // Modify your single entry form submission listener
284
+ form.addEventListener('submit', async (e) => {
285
+ e.preventDefault();
286
+ // ... your existing code ...
287
+
288
+ const formData = new FormData(form);
289
+ const data = {};
290
+ formData.forEach((value, key) => {
291
+ data[key] = value;
292
+ });
293
+
294
+ // Call the new function to convert values to numbers
295
+ const processedData = convertToNumbers(data);
296
+
297
+ const backendEndpoint = 'http://localhost:5000/predict';
298
+ // Prepare UI
299
+ predictionResult.classList.remove('hidden');
300
+ predictionResult.textContent = 'Checking eligibility...';
301
+ predictionResult.classList.remove('bg-green-100', 'bg-red-100', 'text-green-800', 'text-red-800');
302
+ try {
303
+ const response = await fetch(backendEndpoint, {
304
+ method: 'POST',
305
+ headers: { 'Content-Type': 'application/json' },
306
+ body: JSON.stringify(processedData),
307
+ });
308
+
309
+ if (!response.ok) {
310
+ throw new Error(`HTTP error! status: ${response.status}`);
311
+ }
312
+
313
+ const result = await response.json();
314
+
315
+ // The new debugging line 👇
316
+ console.log("Backend response received:", result);
317
+
318
+ displayMetrics(result.metrics);
319
+
320
+ const predictionValue = (result && result.prediction) ? String(result.prediction).toLowerCase() : '';
321
+ // Reset classes before applying new ones
322
+ predictionResult.classList.remove('bg-green-100', 'bg-red-100', 'text-green-800', 'text-red-800');
323
+ if (predictionValue === 'eligible') {
324
+ predictionResult.textContent = 'Congratulations! You are eligible for a loan.';
325
+ predictionResult.classList.add('bg-green-100', 'text-green-800');
326
+ } else if (predictionValue === 'not eligible' || predictionValue === 'ineligible') {
327
+ predictionResult.textContent = "We're sorry, you are not eligible for a loan at this time.";
328
+ predictionResult.classList.add('bg-red-100', 'text-red-800');
329
+ } else {
330
+ predictionResult.textContent = 'Received a response from the backend, but no prediction was found.';
331
+ predictionResult.classList.add('bg-red-100', 'text-red-800');
332
+ }
333
+ } catch (error) {
334
+ console.error('Error:', error);
335
+ predictionResult.textContent = `There was a problem checking your eligibility. Please ensure the backend is running at ${backendEndpoint}.`;
336
+ predictionResult.classList.add('bg-red-100', 'text-red-800');
337
+ }
338
+ });
339
+
340
+ // Handle CSV form submission
341
+ csvForm.addEventListener('submit', async (e) => {
342
+ e.preventDefault();
343
+ predictionResult.classList.remove('hidden');
344
+ predictionResult.innerHTML = 'Processing CSV file...';
345
+ predictionResult.classList.remove('bg-green-100', 'bg-red-100', 'text-green-800', 'text-red-800');
346
+ csvResultsContainer.classList.add('hidden'); // Hide the container before showing results
347
+
348
+ const csvFile = document.getElementById('csvFile').files[0];
349
+ if (!csvFile) {
350
+ predictionResult.textContent = 'Please select a CSV file to upload.';
351
+ predictionResult.classList.add('bg-red-100', 'text-red-800');
352
+ return;
353
+ }
354
+
355
+ const formData = new FormData();
356
+ formData.append('file', csvFile);
357
+
358
+ const backendEndpoint = 'http://localhost:5000/predict_csv';
359
+ try {
360
+ const response = await fetch(backendEndpoint, {
361
+ method: 'POST',
362
+ body: formData,
363
+ });
364
+
365
+ if (!response.ok) {
366
+ throw new Error(`HTTP error! status: ${response.status}`);
367
+ }
368
+
369
+ const result = await response.json();
370
+
371
+ displayMetrics(result.metrics);
372
+ displayFairnessMetrics(result.fairness_metrics, result.fairness_observation);
373
+ displayCsvResults(result.predictions);
374
+
375
+ csvResultsContainer.classList.remove('hidden'); // Show the container now
376
+ predictionResult.classList.add('hidden');
377
+ } catch (error) {
378
+ console.error('Error:', error);
379
+ predictionResult.textContent = `There was a problem processing the CSV file. Please ensure the backend is running at ${backendEndpoint}.`;
380
+ predictionResult.classList.add('bg-red-100', 'text-red-800');
381
+ }
382
+ });
383
+
384
+ function displayCsvResults(predictions) {
385
+ csvResultsTable.classList.remove('hidden');
386
+ let html = `<div class="overflow-x-auto rounded-lg shadow-md">
387
+ <table class="min-w-full table-auto divide-y divide-gray-200">
388
+ <thead class="bg-gray-200">
389
+ <tr>`;
390
+
391
+ // Create table headers
392
+ if (predictions.length > 0) {
393
+ const headers = Object.keys(predictions[0]);
394
+ headers.forEach(header => {
395
+ html += `<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider">${header}</th>`;
396
+ });
397
+ }
398
+ html += `</tr>
399
+ </thead>
400
+ <tbody class="bg-white divide-y divide-gray-200">`;
401
+
402
+ // Create table rows with data
403
+ predictions.forEach(row => {
404
+ html += `<tr>`;
405
+ Object.values(row).forEach(value => {
406
+ html += `<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-600">${value}</td>`;
407
+ });
408
+ html += `</tr>`;
409
+ });
410
+
411
+ html += `</tbody></table></div>`;
412
+ csvResultsTable.innerHTML = html;
413
+ }
414
+ });
415
+ </script>
416
+ </body>
417
+ </html>