Spaces:
Runtime error
Runtime error
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Token Count Dashboard</title> | |
| <style> | |
| body { | |
| font-family: Arial, sans-serif; | |
| text-align: center; | |
| margin: 0; | |
| padding: 20px; | |
| } | |
| .metric { | |
| margin: 20px 0; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <h1>Token Count Dashboard</h1> | |
| <div class="metric"> | |
| <h2>Total Token Count</h2> | |
| <p id="token-count">Loading...</p> | |
| </div> | |
| <div class="metric"> | |
| <h2>Total Growth Speed</h2> | |
| <p id="growth-speed">Loading...</p> | |
| </div> | |
| <script> | |
| const client1Url = 'https://orionai-training-data-collection-2.hf.space/api/update_token_display'; | |
| const client2Url = 'https://orionai-training-data-collection-3.hf.space/api/update_token_display'; | |
| const client3Url = 'https://orionai-training-data-collection.hf.space/api/update_token_display'; | |
| async function getTokenCount(url) { | |
| try { | |
| const response = await fetch(url); | |
| const result = await response.json(); | |
| return parseInt(result); | |
| } catch (error) { | |
| console.error('Error fetching token count:', error); | |
| return 0; | |
| } | |
| } | |
| async function updateMetrics() { | |
| try { | |
| const count1 = await getTokenCount(client1Url); | |
| const count2 = await getTokenCount(client2Url); | |
| const count3 = await getTokenCount(client3Url); | |
| const totalTokens = count1 + count2 + count3; | |
| const growthSpeed = count1 + count2 + count3; // Replace with actual growth speed calculation | |
| document.getElementById('token-count').innerText = totalTokens; | |
| document.getElementById('growth-speed').innerText = growthSpeed; | |
| } catch (error) { | |
| console.error('Error updating metrics:', error); | |
| } | |
| } | |
| setInterval(updateMetrics, 5000); // Update every 5 seconds | |
| // Initial call to display data immediately on load | |
| updateMetrics(); | |
| </script> | |
| </body> | |
| </html> | |