Spaces:
Running
Running
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Ready Xet Go</title> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.9.1/chart.min.js"></script> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/PapaParse/5.3.0/papaparse.min.js"></script> | |
| <link rel="stylesheet" href="style.css"> | |
| </head> | |
| <body> | |
| <div class="hero-band"> | |
| <h1 class="hero-title">Ready Xet Go</h1> | |
| <p class="hero-subtitle">At the speed of chunks</p> | |
| </div> | |
| <div class="stats-card"> | |
| <div class="card"> | |
| <h2>Xet Migration Progress</h2> | |
| <div class="progress-container"> | |
| <div class="progress-bar" id="progressBar">0%</div> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="chart-card"> | |
| <div class="card"> | |
| <h2>Repos Migrated to Xet</h2> | |
| <div class="chart-container"> | |
| <canvas id="progressChart"></canvas> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| const CSV_URL = 'https://huggingface.co/datasets/jsulz/ready-xet-go/resolve/main/progress.csv'; | |
| (async () => { | |
| const rows = []; | |
| const csv = await new Promise((resolve, reject) => { | |
| Papa.parse(CSV_URL, { | |
| download: true, | |
| header : true, | |
| complete: resolve, | |
| error : reject | |
| }); | |
| }); | |
| csv.data.forEach(row => { | |
| if (row.date && row.xet_repos && row.hub_repos) { | |
| rows.push({ | |
| date: new Date(row.date), | |
| xet_repos: parseInt(row.xet_repos, 10), | |
| hub_repos: parseInt(row.hub_repos, 10) | |
| }); | |
| } | |
| }); | |
| // Progress Bar Constants | |
| const max_value = 100; | |
| const current_status = Math.round((rows[rows.length - 1].xet_repos / rows[rows.length - 1].hub_repos) * max_value); | |
| // Animate Progress Bar - increments smoothly every 50ms | |
| const progressBar = document.getElementById('progressBar'); | |
| let currentProgress = 0; | |
| function animateProgressBar() { | |
| if (currentProgress < current_status) { | |
| currentProgress++; | |
| progressBar.style.width = `${currentProgress}%`; | |
| progressBar.textContent = `${currentProgress}%`; | |
| setTimeout(animateProgressBar, 50); | |
| } | |
| } | |
| animateProgressBar(); | |
| // Chart Constants | |
| // Use the latest date from the CSV for the end date | |
| const endDate = rows[rows.length - 1].date; | |
| const startDate = rows[0].date; | |
| const maxCount = Math.max( | |
| ...rows.map(row => row.xet_repos), | |
| ); | |
| const dataPoints = rows.map(row => ({ | |
| date: row.date, | |
| value: row.xet_repos | |
| })); | |
| // Format date for display (MMM D YYYY) | |
| function formatDate(dateStr) { | |
| return new Date(dateStr).toLocaleDateString('en-US', { | |
| year: 'numeric', month: 'short', day: 'numeric' | |
| }); | |
| } | |
| // Initialize Chart with smooth animation | |
| const ctx = document.getElementById('progressChart').getContext('2d'); | |
| new Chart(ctx, { | |
| type: 'line', | |
| data: { | |
| labels: dataPoints.map(point => formatDate(point.date)), | |
| datasets: [{ | |
| label: 'Repos Migrated', | |
| data: dataPoints.map(point => point.value), | |
| borderColor: '#7875FF', | |
| backgroundColor: 'rgba(255, 127, 65, 1)', | |
| tension: 0.4 // Smooth curve | |
| }] | |
| }, | |
| options: { | |
| responsive: true, | |
| maintainAspectRatio: false, | |
| animation: { duration: 2000 }, | |
| scales: { | |
| y: { | |
| min: 0, | |
| max: maxCount, | |
| ticks: { stepSize: 100000 } | |
| }, | |
| x: { | |
| ticks: { | |
| maxTicksLimit: 20 | |
| } | |
| }, | |
| }, | |
| plugins: { | |
| tooltip: { | |
| callbacks: { | |
| label: function(context) { | |
| return `Repos Migrated: ${context.parsed.y.toLocaleString()}`; | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }); | |
| })(); | |
| </script> | |
| </body> | |
| </html> |