File size: 2,276 Bytes
654be7b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE html>
<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>