-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
405 lines (343 loc) · 11.8 KB
/
index.html
File metadata and controls
405 lines (343 loc) · 11.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>AI DataScience Lab</title>
<style>
body {
margin: 0;
padding: 40px 0;
font-family: 'Segoe UI', sans-serif;
color: #fff;
background: linear-gradient(-45deg, #1b2735, #2c5364, #0f2027, #203a43);
background-size: 400% 400%;
animation: gradientBG 20s ease infinite;
}
@keyframes gradientBG {
0% {background-position: 0% 50%;}
50% {background-position: 100% 50%;}
100% {background-position: 0% 50%;}
}
h1, label {
text-align: center;
color: #f1f1f1;
}
h3 {
text-align: left;
color: #f1f1f1;
}
h4 {
text-align: center;
color: #f1f1f1;
}
h2 {
font-weight: normal;
font-size: 16px;
color: #ccc;
text-align: center;
}
.section {
margin: 30px auto;
text-align: center;
}
.section-left {
max-width: 800px;
margin: 30px auto;
text-align: left;
padding: 0 20px;
}
form {
display: flex;
flex-direction: column;
align-items: center;
}
label {
margin-bottom: 5px;
}
input[type="file"],
input[type="text"],
select {
width: 200px;
margin-bottom: 10px;
padding: 8px;
border-radius: 6px;
border: 1px solid #ccc;
font-size: 14px;
background-color: #fff;
color: #000;
}
button {
padding: 8px 16px;
margin: 5px 0;
border-radius: 6px;
border: none;
background-color: #00bcd4;
color: white;
cursor: pointer;
font-size: 14px;
}
button:hover {
background-color: #0097a7;
}
.progress-bar {
width: 200px;
height: 8px;
background-color: #eee;
border-radius: 4px;
overflow: hidden;
margin-top: 5px;
margin-bottom: 15px;
display: none;
}
.progress-fill {
height: 100%;
width: 0%;
transition: width 0.4s ease;
}
.green { background-color: #4CAF50; }
.blue { background-color: #2196F3; }
.output-box {
background: rgba(255, 255, 255, 0.1);
padding: 15px;
border: 1px solid #66d9ef;
border-radius: 8px;
color: #e0f7fa;
font-size: 14px;
font-family: monospace;
white-space: pre-wrap;
overflow-x: auto;
max-width: 100%;
}
img {
display: block;
max-width: 100%;
margin-top: 10px;
border-radius: 8px;
}
.hidden {
display: none;
}
.footer {
text-align: center;
font-size: 13px;
color: #ccc;
margin-top: 60px;
}
.footer a, a {
color: #66d9ef;
text-decoration: none;
}
.dropdown-label {
text-align: left;
margin-left: 20px;
font-weight: bold;
}
.more-note {
font-size: 12px;
color: #aaa;
text-align: left;
margin-left: 20px;
font-style: italic;
}
.description {
text-align: left;
max-width: 800px;
margin: 0 auto 20px;
padding: 0 20px;
color: #ddd;
font-size: 15px;
line-height: 1.5;
}
.note {
font-size: 13px;
color: #ccc;
margin-top: -5px;
margin-bottom: 10px;
}
.fade-in {
opacity: 0;
transform: translateY(20px);
animation: fadeInUp 0.6s ease-out forwards;
}
@keyframes fadeInUp {
to {
opacity: 1;
transform: translateY(0);
}
}
</style>
</head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-9D3J9V8DM9"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-9D3J9V8DM9');
</script>
<body>
<h1>AI Data-Science Lab</h1>
<h2>Built with Pandas, scikit-learn, and OpenAI GPT-3.5 API</h2>
<h2>(<a href="https://github.com/Hariprashad-Ravikumar/AI-DataScience-Lab" target="_blank">View source code on Hari's GitHub</a>)</h2>
<!-- Upload -->
<div class="section">
<h4>Upload your dataset to receive intelligent insights powered by AI. Our tool cleans your data, builds a predictive model, and explains the trends using OpenAI. Visualizations and downloadable reports included.</h4>
<form id="uploadForm">
<label for="fileInput">Choose CSV File</label>
<input type="file" id="fileInput" name="file" required />
<button id="loadColumnsBtn" type="button">Upload</button>
<div id="uploadProgress" class="progress-bar"><div class="progress-fill green" id="uploadFill"></div></div>
<label for="xColumn" class="hidden">X Column</label>
<select id="xColumn" name="x_column" class="hidden"></select>
<label for="yColumn" class="hidden">Y Column</label>
<select id="yColumn" name="y_column" class="hidden"></select>
<button id="submitProcessing" class="hidden" type="submit">Submit for Processing</button>
<div id="processProgress" class="progress-bar"><div class="progress-fill green" id="processFill"></div></div>
</form>
</div>
<!-- Model selection -->
<div class="section-left">
<label class="dropdown-label">Choose Regression</label>
<select id="regressionModel" name="model" disabled>
<option value="linear">Linear Regression</option>
</select>
<div class="more-note">(More regression models coming in v2)</div>
</div>
<!-- Processing results -->
<div id="processingResults" class="hidden">
<div class="section-left">
<h3>Processing Log</h3>
<div class="output-box" id="log">Loading modules: pandas, scikit-learn, matplotlib...</div>
</div>
<div class="section-left">
<h3>Data Summary (by OpenAI GPT-3.5 API)</h3>
<div class="output-box" id="summary" style="max-height: 200px; overflow-y: auto;"></div>
</div>
<div class="section-left">
<h3>Model Performance</h3>
<div class="output-box" id="metrics"></div>
</div>
<div class="section-left">
<h3>Scatter Plot</h3>
<img id="plot" style="display:none;" alt="Scatter Plot" />
</div>
<div class="section">
<form id="predictForm">
<label for="futureInput">Enter future values (comma-separated)</label>
<div class="note">Example: 2025-12-01, 2025-12-02, ... or 11, 12, 13</div>
<input type="text" id="futureInput" name="future_x" />
<button type="submit">Predict</button>
<div id="predictProgress" class="progress-bar"><div class="progress-fill blue" id="predictFill"></div></div>
</form>
</div>
</div>
<!-- Forecast results -->
<div id="forecastResults" class="hidden">
<div class="section-left">
<h3>Forecast Result</h3>
<div class="output-box" id="forecast"></div>
</div>
<div class="section-left">
<h3>Forecast Visualization</h3>
<img id="forecastPlot" style="display:none;" alt="Forecast Plot" />
</div>
<div class="section">
<a href="https://ai-dslab-backend-cpf2feachnetbbck.westus-01.azurewebsites.net/download-report" target="_blank">
<button>Download PDF Report</button>
</a>
</div>
</div>
<div class="footer">
<small style="color:#aaa;">App Version: 1.0.0 (Beta)</small>
<br> © 2025 Hariprashad Ravikumar · All rights reserved<br>
<a href="https://hariprashad-ravikumar.github.io" target="_blank">Website</a> ·
<a href="https://github.com/Hariprashad-Ravikumar" target="_blank">GitHub</a>
</div>
<!-- JavaScript -->
<script>
const fileInput = document.getElementById('fileInput');
const xColumn = document.getElementById('xColumn');
const yColumn = document.getElementById('yColumn');
const uploadFill = document.getElementById('uploadFill');
const processFill = document.getElementById('processFill');
const predictFill = document.getElementById('predictFill');
const processingResults = document.getElementById('processingResults');
const forecastResults = document.getElementById('forecastResults');
document.getElementById('loadColumnsBtn').addEventListener('click', async () => {
const file = fileInput.files[0];
if (!file) return alert("Please select a CSV file.");
const formData = new FormData();
formData.append('file', file);
document.getElementById('uploadProgress').style.display = 'block';
uploadFill.style.width = '30%';
const res = await fetch('https://ai-dslab-backend-cpf2feachnetbbck.westus-01.azurewebsites.net/get-columns', {
method: 'POST',
body: formData
});
const data = await res.json();
if (!data.columns) return alert("Failed to load columns.");
xColumn.innerHTML = yColumn.innerHTML = '';
data.columns.forEach(col => {
xColumn.innerHTML += `<option value="${col}">${col}</option>`;
yColumn.innerHTML += `<option value="${col}">${col}</option>`;
});
xColumn.classList.remove('hidden');
yColumn.classList.remove('hidden');
xColumn.previousElementSibling.classList.remove('hidden');
yColumn.previousElementSibling.classList.remove('hidden');
document.getElementById('submitProcessing').classList.remove('hidden');
uploadFill.style.width = '100%';
setTimeout(() => document.getElementById('uploadProgress').style.display = 'none', 500);
});
document.getElementById('uploadForm').addEventListener('submit', async (e) => {
e.preventDefault();
const formData = new FormData();
formData.append('file', fileInput.files[0]);
formData.append('x_column', xColumn.value);
formData.append('y_column', yColumn.value);
formData.append('model', 'linear');
document.getElementById('processProgress').style.display = 'block';
processFill.style.width = '20%';
const res = await fetch('https://ai-dslab-backend-cpf2feachnetbbck.westus-01.azurewebsites.net/upload', {
method: 'POST',
body: formData
});
const data = await res.json();
processFill.style.width = '100%';
setTimeout(() => document.getElementById('processProgress').style.display = 'none', 500);
document.getElementById('regressionModel').disabled = false;
processingResults.classList.remove('hidden');
processingResults.classList.add('fade-in');
document.getElementById('summary').textContent = data.summary || '';
document.getElementById('log').textContent = data.log || '';
document.getElementById('metrics').textContent = `R² Score: ${data.r2_score}\nMSE: ${data.mse}`;
document.getElementById('plot').src = data.plot_url;
document.getElementById('plot').style.display = 'block';
});
document.getElementById('predictForm').addEventListener('submit', async (e) => {
e.preventDefault();
const formData = new FormData();
formData.append('future_x', document.getElementById('futureInput').value);
formData.append('x_column', xColumn.value);
formData.append('y_column', yColumn.value);
document.getElementById('predictProgress').style.display = 'block';
predictFill.style.width = '30%';
const res = await fetch('https://ai-dslab-backend-cpf2feachnetbbck.westus-01.azurewebsites.net/predict', {
method: 'POST',
body: formData
});
const data = await res.json();
predictFill.style.width = '100%';
setTimeout(() => document.getElementById('predictProgress').style.display = 'none', 500);
forecastResults.classList.remove('hidden');
forecastResults.classList.add('fade-in');
document.getElementById('forecast').textContent = typeof data.forecast === "string"
? data.forecast
: JSON.stringify(data.forecast, null, 2);
document.getElementById('forecastPlot').src = data.forecast_plot_url + '?t=' + new Date().getTime();
document.getElementById('forecastPlot').style.display = 'block';
});
</script>
</body>
</html>