Update src/App.js
Browse files- src/App.js +38 -2
src/App.js
CHANGED
@@ -118,8 +118,44 @@ const UrologyLeaderboard = () => {
|
|
118 |
];
|
119 |
|
120 |
const loadData = async () => {
|
121 |
-
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
};
|
124 |
|
125 |
const refreshData = async () => {
|
|
|
118 |
];
|
119 |
|
120 |
const loadData = async () => {
|
121 |
+
try {
|
122 |
+
// Intentar cargar datos reales desde HuggingFace
|
123 |
+
const response = await fetch('https://datasets-server.huggingface.co/rows?dataset=SASLeaderboard/results&config=default&split=train');
|
124 |
+
|
125 |
+
if (response.ok) {
|
126 |
+
const data = await response.json();
|
127 |
+
console.log('Raw HuggingFace data:', data);
|
128 |
+
|
129 |
+
// Procesar los datos reales
|
130 |
+
const processedData = data.rows.map(row => {
|
131 |
+
const config = row.row.config;
|
132 |
+
const results = row.row.results;
|
133 |
+
|
134 |
+
return {
|
135 |
+
model: config.model || 'Unknown Model',
|
136 |
+
baseModel: config.base_model || '',
|
137 |
+
accuracy: results.overall?.accuracy || 0,
|
138 |
+
totalQuestions: results.overall?.total_questions || 151,
|
139 |
+
correctAnswers: Math.round((results.overall?.accuracy || 0) * (results.overall?.total_questions || 151)),
|
140 |
+
license: config.license || 'Unknown',
|
141 |
+
submitType: config.submit_type || 'unknown',
|
142 |
+
submittedTime: config.submitted_time || new Date().toISOString(),
|
143 |
+
params: config.params || 0,
|
144 |
+
precision: config.precision || 'unknown',
|
145 |
+
status: config.status || 'UNKNOWN'
|
146 |
+
};
|
147 |
+
});
|
148 |
+
|
149 |
+
console.log('Processed data:', processedData);
|
150 |
+
return processedData;
|
151 |
+
} else {
|
152 |
+
console.log('HuggingFace API failed, using mock data');
|
153 |
+
return mockData;
|
154 |
+
}
|
155 |
+
} catch (error) {
|
156 |
+
console.log('Error loading from HuggingFace, using mock data:', error);
|
157 |
+
return mockData;
|
158 |
+
}
|
159 |
};
|
160 |
|
161 |
const refreshData = async () => {
|