xyplon
commited on
Update static/models.js
Browse files- static/models.js +5 -14
static/models.js
CHANGED
@@ -223,18 +223,9 @@ btn.onclick = async () => {
|
|
223 |
generateImage()
|
224 |
|
225 |
}
|
226 |
-
async function fetchData() {
|
227 |
-
try {
|
228 |
-
const response = await fetch('https://xyplon.onrender.com/');
|
229 |
-
if (!response.ok) {
|
230 |
-
throw new Error(`HTTP error! Status: ${response.status}`);
|
231 |
-
}
|
232 |
-
const data = await response.json();
|
233 |
-
const formattedData = `Pending Requests: ${data["Pending (Generating): "]} Total Requests: ${data["Total Requests: "]}`;
|
234 |
-
document.getElementById('stats').textContent = formattedData;
|
235 |
-
} catch (error) {
|
236 |
-
document.getElementById('stats').textContent = `Error: ${error.message}`;
|
237 |
-
}
|
238 |
-
}
|
239 |
|
240 |
-
|
|
|
|
|
|
|
|
|
|
223 |
generateImage()
|
224 |
|
225 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
|
227 |
+
const socket = io();
|
228 |
+
|
229 |
+
socket.on('update', function(data) {
|
230 |
+
document.getElementById('stats').textContent = `Pending (Generating): ${data["Pending Requests"]} Total Requests: ${data["Total Requests"]}`;
|
231 |
+
});
|