xyplon commited on
Commit
06ae81c
·
verified ·
1 Parent(s): 30d40b2

Update static/models.js

Browse files
Files changed (1) hide show
  1. 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
- setInterval(fetchData, 1000);
 
 
 
 
 
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
+ });