File size: 1,332 Bytes
1af45d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import React, { FC } from 'react';
import { AllModelsData } from '../types';

interface Props {
  data: AllModelsData;
  metrics: string[];
}

const ComparisonTable: FC<Props> = ({ data, metrics }) => {
  const models = Object.keys(data);

  return (
    <div className="bg-white rounded-xl shadow-lg p-6 overflow-x-auto">
      <h2 className="text-2xl font-bold text-gray-800 mb-6">Model Comparison Table</h2>
      <table className="w-full text-sm">
        <thead>
          <tr className="border-b border-gray-200">
            <th className="text-left py-3 px-4 font-semibold">Model</th>
            {metrics.map(m => (
              <th key={m} className="text-center py-3 px-4 font-semibold">{m.toUpperCase()}</th>
            ))}
          </tr>
        </thead>
        <tbody>
          {models.map(model => (
            <tr key={model} className="border-b border-gray-100 hover:bg-gray-50">
              <td className="py-3 px-4 font-medium">{model}</td>
              {metrics.map(metric => (
                <td key={metric} className="text-center py-3 px-4">
                  {data[model].averages[metric as keyof typeof data[string]['averages']].toFixed(3)}
                </td>
              ))}
            </tr>
          ))}
        </tbody>
      </table>
    </div>
  );
};

export default ComparisonTable;