oscarwang2 commited on
Commit
654be7b
1 Parent(s): fc6943d

Create index.html

Browse files
Files changed (1) hide show
  1. index.html +67 -0
index.html ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Token Count Dashboard</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ text-align: center;
11
+ margin: 0;
12
+ padding: 20px;
13
+ }
14
+ .metric {
15
+ margin: 20px 0;
16
+ }
17
+ </style>
18
+ </head>
19
+ <body>
20
+ <h1>Token Count Dashboard</h1>
21
+ <div class="metric">
22
+ <h2>Total Token Count</h2>
23
+ <p id="token-count">Loading...</p>
24
+ </div>
25
+ <div class="metric">
26
+ <h2>Total Growth Speed</h2>
27
+ <p id="growth-speed">Loading...</p>
28
+ </div>
29
+ <script>
30
+ const client1Url = 'https://orionai-training-data-collection-2.hf.space/api/update_token_display';
31
+ const client2Url = 'https://orionai-training-data-collection-3.hf.space/api/update_token_display';
32
+ const client3Url = 'https://orionai-training-data-collection.hf.space/api/update_token_display';
33
+
34
+ async function getTokenCount(url) {
35
+ try {
36
+ const response = await fetch(url);
37
+ const result = await response.json();
38
+ return parseInt(result);
39
+ } catch (error) {
40
+ console.error('Error fetching token count:', error);
41
+ return 0;
42
+ }
43
+ }
44
+
45
+ async function updateMetrics() {
46
+ try {
47
+ const count1 = await getTokenCount(client1Url);
48
+ const count2 = await getTokenCount(client2Url);
49
+ const count3 = await getTokenCount(client3Url);
50
+
51
+ const totalTokens = count1 + count2 + count3;
52
+ const growthSpeed = count1 + count2 + count3; // Replace with actual growth speed calculation
53
+
54
+ document.getElementById('token-count').innerText = totalTokens;
55
+ document.getElementById('growth-speed').innerText = growthSpeed;
56
+ } catch (error) {
57
+ console.error('Error updating metrics:', error);
58
+ }
59
+ }
60
+
61
+ setInterval(updateMetrics, 5000); // Update every 5 seconds
62
+
63
+ // Initial call to display data immediately on load
64
+ updateMetrics();
65
+ </script>
66
+ </body>
67
+ </html>