RafaelJaime commited on
Commit
12b937b
Β·
verified Β·
1 Parent(s): 2964b91

Update src/App.js

Browse files
Files changed (1) hide show
  1. src/App.js +102 -119
src/App.js CHANGED
@@ -26,25 +26,47 @@ const UrologyLeaderboard = () => {
26
  throw new Error('No data found in the dataset');
27
  }
28
 
29
- const processedData = data.rows.map(row => {
30
- const config = row.row.config;
31
- const results = row.row.results;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
- return {
34
- model: config.model || 'Unknown Model',
35
- baseModel: config.base_model || '',
36
- accuracy: results.overall?.accuracy || 0,
37
- totalQuestions: results.overall?.total_questions || 151,
38
- correctAnswers: Math.round((results.overall?.accuracy || 0) * (results.overall?.total_questions || 151)),
39
- license: config.license || 'Unknown',
40
- submitType: config.submit_type || 'unknown',
41
- submittedTime: config.submitted_time || new Date().toISOString(),
42
- params: config.params || 0,
43
- precision: config.precision || 'unknown',
44
- status: config.status || 'UNKNOWN'
45
- };
46
  });
47
 
 
 
 
 
 
 
48
  console.log('Processed data:', processedData);
49
  return processedData;
50
  } catch (error) {
@@ -85,6 +107,7 @@ const UrologyLeaderboard = () => {
85
  }, []);
86
 
87
  const filteredAndSortedData = useMemo(() => {
 
88
  if (error) {
89
  return [];
90
  }
@@ -337,7 +360,7 @@ const UrologyLeaderboard = () => {
337
  color: '#c4b5fd'
338
  },
339
  infoSection: {
340
- marginTop: '16px',
341
  display: 'flex',
342
  flexDirection: 'column',
343
  gap: '24px'
@@ -357,25 +380,6 @@ const UrologyLeaderboard = () => {
357
  padding: '16px',
358
  textAlign: 'center'
359
  },
360
- academicTextSection: {
361
- marginBottom: '24px'
362
- },
363
- academicImagesSection: {
364
- display: 'flex',
365
- justifyContent: 'space-around',
366
- alignItems: 'center',
367
- gap: '20px',
368
- flexWrap: 'wrap'
369
- },
370
- logoImage: {
371
- width: '160px',
372
- height: '160px',
373
- cursor: 'pointer',
374
- background: 'white',
375
- borderRadius: '8px',
376
- padding: '4px',
377
- flexShrink: 0
378
- },
379
  loadingContainer: {
380
  minHeight: '100vh',
381
  background: 'linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #3730a3 100%)',
@@ -427,7 +431,21 @@ const UrologyLeaderboard = () => {
427
  React.createElement('div', { style: styles.innerContainer },
428
  React.createElement('div', { style: styles.header },
429
  React.createElement('h1', { style: styles.title }, 'πŸ† Urology AI Leaderboard'),
430
- React.createElement('p', { style: styles.subtitle }, 'Evaluating Natural Language Models on Urology Knowledge Assessment')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
431
  ),
432
  React.createElement('div', { style: styles.controlsContainer },
433
  React.createElement('div', { style: styles.inputGroup },
@@ -575,53 +593,9 @@ const UrologyLeaderboard = () => {
575
  ),
576
  React.createElement('div', { style: styles.infoSection },
577
  React.createElement('div', { style: styles.infoCard },
578
- React.createElement('h3', { style: { fontSize: '20px', fontWeight: '600', color: 'white', marginBottom: '16px' } }, 'πŸ“ˆ Statistics'),
579
- React.createElement('div', { style: { display: 'flex', justifyContent: 'space-around', gap: '20px', flexWrap: 'wrap', marginBottom: '8px' } },
580
- React.createElement('div', { style: { textAlign: 'center' } },
581
- React.createElement('div', { style: { fontSize: '24px', fontWeight: 'bold', color: '#60a5fa' } }, filteredAndSortedData.length),
582
- React.createElement('div', { style: { fontSize: '14px', color: '#d1d5db' } }, 'Models')
583
- ),
584
- React.createElement('div', { style: { textAlign: 'center' } },
585
- React.createElement('div', { style: { fontSize: '24px', fontWeight: 'bold', color: '#34d399' } },
586
- filteredAndSortedData.length > 0 ?
587
- Math.round(filteredAndSortedData.reduce((sum, item) => sum + item.correctAnswers, 0) / filteredAndSortedData.length) :
588
- 0
589
- ),
590
- React.createElement('div', { style: { fontSize: '14px', color: '#d1d5db' } }, 'Mean')
591
- ),
592
- React.createElement('div', { style: { textAlign: 'center' } },
593
- React.createElement('div', { style: { fontSize: '24px', fontWeight: 'bold', color: '#a78bfa' } },
594
- filteredAndSortedData.length > 0 ? (() => {
595
- const sortedAnswers = [...filteredAndSortedData].sort((a, b) => a.correctAnswers - b.correctAnswers);
596
- const mid = Math.floor(sortedAnswers.length / 2);
597
- const median = sortedAnswers.length % 2 === 0 ?
598
- Math.round((sortedAnswers[mid - 1].correctAnswers + sortedAnswers[mid].correctAnswers) / 2) :
599
- sortedAnswers[mid].correctAnswers;
600
- return median;
601
- })() : 0
602
- ),
603
- React.createElement('div', { style: { fontSize: '14px', color: '#d1d5db' } }, 'Median')
604
- ),
605
- React.createElement('div', { style: { textAlign: 'center' } },
606
- React.createElement('div', { style: { fontSize: '24px', fontWeight: 'bold', color: '#fbbf24' } },
607
- filteredAndSortedData.length > 0 ? (() => {
608
- const answersMap = {};
609
- filteredAndSortedData.forEach(item => {
610
- answersMap[item.correctAnswers] = (answersMap[item.correctAnswers] || 0) + 1;
611
- });
612
- const maxCount = Math.max(...Object.values(answersMap));
613
- const modes = Object.keys(answersMap).filter(key => answersMap[key] === maxCount);
614
- return modes[0];
615
- })() : 0
616
- ),
617
- React.createElement('div', { style: { fontSize: '14px', color: '#d1d5db' } }, 'Mode')
618
- )
619
- )
620
- ),
621
- React.createElement('div', { style: styles.infoCard },
622
- React.createElement('h3', { style: { fontSize: '20px', fontWeight: '600', color: 'white', marginBottom: '8px' } }, 'πŸ“Š About This Evaluation'),
623
  React.createElement('p', { style: { color: '#d1d5db', marginBottom: '12px' } }, 'This leaderboard evaluates natural language models on their ability to answer urology questions. Models must respond to multiple-choice questions about urological knowledge, demonstrating their understanding and mastery of this medical specialty.'),
624
- React.createElement('p', { style: { color: '#d1d5db', marginBottom: '12px' } },
625
  'Questions are from the ',
626
  React.createElement('a', {
627
  href: 'https://www.sspa.juntadeandalucia.es/servicioandaluzdesalud/',
@@ -648,48 +622,69 @@ const UrologyLeaderboard = () => {
648
  )
649
  ),
650
  React.createElement('div', { style: styles.academicCard },
651
- React.createElement('div', { style: styles.academicTextSection },
652
- React.createElement('h4', { style: { fontSize: '18px', fontWeight: '600', color: 'white', marginBottom: '16px', margin: '0 0 16px 0' } }, 'πŸŽ“ Academic Project'),
653
- React.createElement('p', { style: { color: '#d1d5db', fontSize: '14px', margin: 0 } },
654
- 'Final project developed for Artificial Intelligence Models within the ',
655
- React.createElement('a', {
656
- href: 'https://iesrafaelalberti.es/curso-especializacion-inteligencia-artificial-y-big-datatarde/',
657
- target: '_blank',
658
- rel: 'noopener noreferrer',
659
- style: { color: '#60a5fa', textDecoration: 'none', fontWeight: '600' }
660
- }, 'Artificial Intelligence and Big Data'),
661
- ' specialization course at ',
662
- React.createElement('a', {
663
- href: 'https://iesrafaelalberti.es/',
664
- target: '_blank',
665
- rel: 'noopener noreferrer',
666
- style: { color: '#60a5fa', textDecoration: 'none', fontWeight: '600' }
667
- }, 'IES Rafael Alberti')
668
- )
669
- ),
670
- React.createElement('div', { style: styles.academicImagesSection },
671
  React.createElement('a', {
672
  href: 'https://iesrafaelalberti.es/',
673
  target: '_blank',
674
  rel: 'noopener noreferrer',
675
- style: { textDecoration: 'none' }
676
  },
677
  React.createElement('img', {
678
  src: 'https://avatars.githubusercontent.com/u/79144080?s=200&v=4',
679
  alt: 'IES Rafael Alberti Logo',
680
- style: styles.logoImage
 
 
 
 
 
 
 
681
  })
682
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
683
  React.createElement('a', {
684
  href: 'https://iesrafaelalberti.es/curso-especializacion-inteligencia-artificial-y-big-datatarde/',
685
  target: '_blank',
686
  rel: 'noopener noreferrer',
687
- style: { textDecoration: 'none' }
688
  },
689
  React.createElement('img', {
690
  src: '/IA-Big-Data-cuadrado.png',
691
  alt: 'AI and Big Data Course Logo',
692
- style: styles.logoImage,
 
 
 
 
 
 
 
693
  onError: (e) => {
694
  console.log('Error loading course image from public folder');
695
  },
@@ -697,18 +692,6 @@ const UrologyLeaderboard = () => {
697
  console.log('Course image loaded successfully from public folder');
698
  }
699
  })
700
- ),
701
- React.createElement('a', {
702
- href: 'https://www.youtube.com/@LUVIDVISION',
703
- target: '_blank',
704
- rel: 'noopener noreferrer',
705
- style: { textDecoration: 'none' }
706
- },
707
- React.createElement('img', {
708
- src: 'https://yt3.googleusercontent.com/Ae7dRhp7TfFS1Ocv2ErGPfgmsFQO7icx6bSbekGqXQfIurhDLIQEuT7HzzTlYavpRoV7ikdEdA=s160-c-k-c0x00ffffff-no-rj',
709
- alt: 'LuvidVision YouTube Channel',
710
- style: styles.logoImage
711
- })
712
  )
713
  )
714
  )
 
26
  throw new Error('No data found in the dataset');
27
  }
28
 
29
+ // Agrupar por modelo y calcular estadΓ­sticas
30
+ const modelStats = {};
31
+
32
+ data.rows.forEach(row => {
33
+ const rowData = row.row;
34
+ const model = rowData.model;
35
+ const isCorrect = rowData.is_correct;
36
+ const timestamp = rowData.timestamp;
37
+
38
+ if (!modelStats[model]) {
39
+ modelStats[model] = {
40
+ model: model,
41
+ baseModel: model.split('/')[1] || model,
42
+ totalQuestions: 0,
43
+ correctAnswers: 0,
44
+ submittedTime: timestamp,
45
+ license: "Unknown",
46
+ submitType: "unknown",
47
+ params: 0,
48
+ precision: "unknown",
49
+ status: "FINISHED"
50
+ };
51
+ }
52
+
53
+ modelStats[model].totalQuestions++;
54
+ if (isCorrect) {
55
+ modelStats[model].correctAnswers++;
56
+ }
57
 
58
+ // Mantener el timestamp mΓ‘s reciente
59
+ if (new Date(timestamp) > new Date(modelStats[model].submittedTime)) {
60
+ modelStats[model].submittedTime = timestamp;
61
+ }
 
 
 
 
 
 
 
 
 
62
  });
63
 
64
+ // Convertir a array y calcular accuracy
65
+ const processedData = Object.values(modelStats).map(stats => ({
66
+ ...stats,
67
+ accuracy: stats.totalQuestions > 0 ? stats.correctAnswers / stats.totalQuestions : 0
68
+ }));
69
+
70
  console.log('Processed data:', processedData);
71
  return processedData;
72
  } catch (error) {
 
107
  }, []);
108
 
109
  const filteredAndSortedData = useMemo(() => {
110
+ // Si hay error, no procesar datos
111
  if (error) {
112
  return [];
113
  }
 
360
  color: '#c4b5fd'
361
  },
362
  infoSection: {
363
+ marginTop: '32px',
364
  display: 'flex',
365
  flexDirection: 'column',
366
  gap: '24px'
 
380
  padding: '16px',
381
  textAlign: 'center'
382
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
383
  loadingContainer: {
384
  minHeight: '100vh',
385
  background: 'linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #3730a3 100%)',
 
431
  React.createElement('div', { style: styles.innerContainer },
432
  React.createElement('div', { style: styles.header },
433
  React.createElement('h1', { style: styles.title }, 'πŸ† Urology AI Leaderboard'),
434
+ React.createElement('p', { style: styles.subtitle }, 'Evaluating Natural Language Models on Urology Knowledge Assessment'),
435
+ React.createElement('div', { style: styles.statsContainer },
436
+ React.createElement('div', { style: styles.statCard },
437
+ React.createElement('div', { style: styles.statNumber }, data.length),
438
+ React.createElement('div', { style: styles.statLabel }, 'Models')
439
+ ),
440
+ React.createElement('div', { style: styles.statCard },
441
+ React.createElement('div', { style: styles.statNumber }, '151'),
442
+ React.createElement('div', { style: styles.statLabel }, 'Questions')
443
+ ),
444
+ React.createElement('div', { style: styles.statCard },
445
+ React.createElement('div', { style: styles.statNumber }, 'SAS Urology'),
446
+ React.createElement('div', { style: styles.statLabel }, 'Specialty')
447
+ )
448
+ )
449
  ),
450
  React.createElement('div', { style: styles.controlsContainer },
451
  React.createElement('div', { style: styles.inputGroup },
 
593
  ),
594
  React.createElement('div', { style: styles.infoSection },
595
  React.createElement('div', { style: styles.infoCard },
596
+ React.createElement('h3', { style: { fontSize: '20px', fontWeight: '600', color: 'white', marginBottom: '12px' } }, 'πŸ“Š About This Evaluation'),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
597
  React.createElement('p', { style: { color: '#d1d5db', marginBottom: '12px' } }, 'This leaderboard evaluates natural language models on their ability to answer urology questions. Models must respond to multiple-choice questions about urological knowledge, demonstrating their understanding and mastery of this medical specialty.'),
598
+ React.createElement('p', { style: { color: '#d1d5db', marginBottom: '16px' } },
599
  'Questions are from the ',
600
  React.createElement('a', {
601
  href: 'https://www.sspa.juntadeandalucia.es/servicioandaluzdesalud/',
 
622
  )
623
  ),
624
  React.createElement('div', { style: styles.academicCard },
625
+ React.createElement('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: '20px', flexWrap: 'wrap' } },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
626
  React.createElement('a', {
627
  href: 'https://iesrafaelalberti.es/',
628
  target: '_blank',
629
  rel: 'noopener noreferrer',
630
+ style: { textDecoration: 'none', flexShrink: 0 }
631
  },
632
  React.createElement('img', {
633
  src: 'https://avatars.githubusercontent.com/u/79144080?s=200&v=4',
634
  alt: 'IES Rafael Alberti Logo',
635
+ style: {
636
+ width: '80px',
637
+ height: '80px',
638
+ cursor: 'pointer',
639
+ background: 'white',
640
+ borderRadius: '8px',
641
+ padding: '4px'
642
+ }
643
  })
644
  ),
645
+ React.createElement('div', { style: { textAlign: 'center', flex: 1, minWidth: '200px' } },
646
+ React.createElement('h4', { style: { fontSize: '18px', fontWeight: '600', color: 'white', marginBottom: '16px', margin: '0 0 16px 0' } }, 'πŸŽ“ Academic Project'),
647
+ React.createElement('div', { style: { display: 'flex', flexDirection: 'column', gap: '8px' } },
648
+ React.createElement('p', { style: { color: '#d1d5db', fontSize: '14px', margin: 0 } },
649
+ 'Final project for ',
650
+ React.createElement('a', {
651
+ href: 'https://iesrafaelalberti.es/',
652
+ target: '_blank',
653
+ rel: 'noopener noreferrer',
654
+ style: { color: '#60a5fa', textDecoration: 'none', fontWeight: '600' }
655
+ }, 'IES Rafael Alberti')
656
+ ),
657
+ React.createElement('p', { style: { color: '#d1d5db', fontSize: '14px', margin: 0 } },
658
+ 'Course: ',
659
+ React.createElement('a', {
660
+ href: 'https://iesrafaelalberti.es/curso-especializacion-inteligencia-artificial-y-big-datatarde/',
661
+ target: '_blank',
662
+ rel: 'noopener noreferrer',
663
+ style: { color: '#60a5fa', textDecoration: 'none', fontWeight: '600' }
664
+ }, 'Artificial Intelligence and Big Data')
665
+ ),
666
+ React.createElement('p', { style: { color: '#d1d5db', fontSize: '14px', margin: 0 } },
667
+ 'Subject: Artificial Intelligence Models'
668
+ )
669
+ )
670
+ ),
671
  React.createElement('a', {
672
  href: 'https://iesrafaelalberti.es/curso-especializacion-inteligencia-artificial-y-big-datatarde/',
673
  target: '_blank',
674
  rel: 'noopener noreferrer',
675
+ style: { textDecoration: 'none', flexShrink: 0 }
676
  },
677
  React.createElement('img', {
678
  src: '/IA-Big-Data-cuadrado.png',
679
  alt: 'AI and Big Data Course Logo',
680
+ style: {
681
+ width: '80px',
682
+ height: '80px',
683
+ cursor: 'pointer',
684
+ background: 'white',
685
+ borderRadius: '8px',
686
+ padding: '4px'
687
+ },
688
  onError: (e) => {
689
  console.log('Error loading course image from public folder');
690
  },
 
692
  console.log('Course image loaded successfully from public folder');
693
  }
694
  })
 
 
 
 
 
 
 
 
 
 
 
 
695
  )
696
  )
697
  )