Skip to content

Commit e0b837a

Browse files
Update index.html
1 parent 2260b0f commit e0b837a

File tree

1 file changed

+52
-11
lines changed

1 file changed

+52
-11
lines changed

index.html

Lines changed: 52 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
body { font-family: Arial, sans-serif; max-width: 800px; margin: 40px auto; padding: 0 20px; color: #333; }
99
h1, h2 { text-align: center; margin: 0; }
1010
h2 { font-size: 18px; font-weight: normal; color: #666; margin-bottom: 20px; }
11-
label, input, button { display: block; width: 100%; margin-bottom: 10px; }
12-
input, button { padding: 8px; box-sizing: border-box; }
11+
label, input, select, button { display: block; width: 100%; margin-bottom: 10px; }
12+
input, select, button { padding: 8px; box-sizing: border-box; }
1313
button { width: auto; cursor: pointer; }
1414
pre, img { margin-top: 10px; border: 1px solid #ccc; padding: 10px; background: #f9f9f9; }
1515
img { max-width: 100%; display: block; }
1616
.section { margin-bottom: 30px; }
17+
#progressBar { width: 100%; height: 10px; background-color: #eee; margin-top: 10px; display: none; }
18+
#progressBar div { height: 100%; background-color: #4CAF50; width: 0%; }
1719
</style>
1820
</head>
1921
<body>
@@ -24,12 +26,13 @@ <h2>AI Forecasting & Analysis Tool</h2>
2426
<form id="uploadForm">
2527
<label for="fileInput">Upload CSV File</label>
2628
<input type="file" id="fileInput" name="file" required />
29+
<div id="progressBar"><div></div></div>
2730

28-
<label for="xColumn">Independent Variable (X column name)</label>
29-
<input type="text" id="xColumn" name="x_column" required />
31+
<label for="xColumn">Independent Variable (X column)</label>
32+
<select id="xColumn" name="x_column" required></select>
3033

31-
<label for="yColumn">Dependent Variable (Y column name)</label>
32-
<input type="text" id="yColumn" name="y_column" required />
34+
<label for="yColumn">Dependent Variable (Y column)</label>
35+
<select id="yColumn" name="y_column" required></select>
3336

3437
<button type="submit">Upload</button>
3538
</form>
@@ -41,7 +44,7 @@ <h3>Processing Log</h3>
4144
</div>
4245

4346
<div class="section">
44-
<h3>Data Summary</h3>
47+
<h3>Data Summary (by OpenAI GPT-3.5 API)</h3>
4548
<pre id="summary" style="max-height: 200px; overflow-y: auto; white-space: pre-wrap;"></pre>
4649
</div>
4750

@@ -57,7 +60,7 @@ <h3>Scatter Plot</h3>
5760

5861
<div class="section">
5962
<form id="predictForm">
60-
<label for="futureInput">Enter future values</label>
63+
<label for="futureInput">Enter future values (comma-separated: YYYY-MM-DD or numbers)</label>
6164
<input type="text" id="futureInput" name="future_x" />
6265
<button type="submit">Predict</button>
6366
</form>
@@ -80,12 +83,50 @@ <h3>Forecast Visualization</h3>
8083
</div>
8184

8285
<script>
86+
const fileInput = document.getElementById('fileInput');
87+
const xColumn = document.getElementById('xColumn');
88+
const yColumn = document.getElementById('yColumn');
89+
const progressBar = document.getElementById('progressBar');
90+
const progressFill = progressBar.querySelector('div');
91+
92+
fileInput.addEventListener('change', async function () {
93+
const formData = new FormData();
94+
formData.append('file', fileInput.files[0]);
95+
96+
progressBar.style.display = 'block';
97+
progressFill.style.width = '25%';
98+
99+
const response = await fetch('https://ai-dslab-backend-cpf2feachnetbbck.westus-01.azurewebsites.net/get-columns', {
100+
method: 'POST',
101+
body: formData
102+
});
103+
104+
const data = await response.json();
105+
xColumn.innerHTML = '';
106+
yColumn.innerHTML = '';
107+
108+
data.columns.forEach(col => {
109+
const optionX = document.createElement('option');
110+
optionX.value = col;
111+
optionX.textContent = col;
112+
xColumn.appendChild(optionX);
113+
114+
const optionY = document.createElement('option');
115+
optionY.value = col;
116+
optionY.textContent = col;
117+
yColumn.appendChild(optionY);
118+
});
119+
120+
progressFill.style.width = '100%';
121+
setTimeout(() => progressBar.style.display = 'none', 500);
122+
});
123+
83124
document.getElementById('uploadForm').addEventListener('submit', async function (e) {
84125
e.preventDefault();
85126
const formData = new FormData();
86-
formData.append('file', document.getElementById('fileInput').files[0]);
87-
formData.append('x_column', document.getElementById('xColumn').value);
88-
formData.append('y_column', document.getElementById('yColumn').value);
127+
formData.append('file', fileInput.files[0]);
128+
formData.append('x_column', xColumn.value);
129+
formData.append('y_column', yColumn.value);
89130

90131
const response = await fetch('https://ai-dslab-backend-cpf2feachnetbbck.westus-01.azurewebsites.net/upload', {
91132
method: 'POST',

0 commit comments

Comments
 (0)