File size: 6,232 Bytes
c041a1a
 
 
 
 
20bd5a1
c041a1a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3330400
c041a1a
 
 
 
 
3330400
 
 
c041a1a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263bc8d
c041a1a
1fb9404
c041a1a
 
 
 
 
 
 
f9bfa06
c041a1a
 
 
 
 
 
 
 
21dd092
c041a1a
21dd092
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c041a1a
 
 
 
 
 
 
 
 
 
 
f9bfa06
 
 
c041a1a
f9bfa06
 
c041a1a
 
 
 
 
 
 
 
 
f9bfa06
 
c041a1a
 
f9bfa06
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c041a1a
 
 
 
 
f9bfa06
 
 
 
c041a1a
 
 
 
 
f9bfa06
c041a1a
 
 
f9bfa06
 
 
 
 
c041a1a
 
 
 
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>LLM Benchmark Overview</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #fdf6fb;
            color: #333;
            margin: 0;
            padding: 20px;
        }
        h1 {
            text-align: center;
            color: #d16ba5;
        }
        .table-container {
            overflow-x: auto;
            margin-top: 20px;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin: 0 auto;
            background-color: #fff;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            table-layout: fixed;
        }
        th, td {
            padding: 10px;
            text-align: left;
            border: 1px solid #ddd;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        th {
            background-color: #f7d9eb;
            color: #333;
            font-weight: bold;
        }
        td.expandable {
            cursor: pointer;
        }
        .filter {
            margin-bottom: 20px;
            text-align: center;
        }
        .filter label {
            font-size: 16px;
            margin-right: 10px;
            color: #d16ba5;
        }
        .filter select {
            padding: 5px;
            font-size: 16px;
            border: 1px solid #ccc;
            border-radius: 5px;
        }
        .expanded {
            white-space: normal;
            background-color: #fcebf7;
        }
    </style>
</head>
<body>
    <h1>LLM Benchmark Overview</h1>
    <div class="filter">
        <label for="metricFilter">Filter by Evaluated task Type:</label>
        <select id="metricFilter">
            <option value="">All</option>
        </select>
    </div>
    <div class="table-container">
        <table id="csvTable">
            <thead>
                <!-- Headers will be dynamically added -->
            </thead>
            <tbody>
                <!-- Rows will be dynamically added here -->
            </tbody>
        </table>
    </div>

    <script>
        // Improved CSV parsing to handle quoted fields
        function parseCSV(content) {
            const rows = [];
            let currentRow = [];
            let currentField = '';
            let insideQuotes = false;

            for (let i = 0; i < content.length; i++) {
                const char = content[i];

                if (char === '"') {
                    insideQuotes = !insideQuotes;
                } else if (char === ',' && !insideQuotes) {
                    currentRow.push(currentField.trim());
                    currentField = '';
                } else if (char === '\n' && !insideQuotes) {
                    currentRow.push(currentField.trim());
                    rows.push(currentRow);
                    currentRow = [];
                    currentField = '';
                } else {
                    currentField += char;
                }
            }

            // Add the last field and row
            if (currentField) currentRow.push(currentField.trim());
            if (currentRow.length > 0) rows.push(currentRow);

            const headers = rows.shift();
            return { headers, rows };
        }

        // Load CSV file
        async function loadCSV(filePath) {
            const response = await fetch(filePath);
            const content = await response.text();
            return parseCSV(content);
        }

        // Populate filter options
        const metricFilter = document.getElementById('metricFilter');
        const table = document.getElementById('csvTable');
        const tableHead = table.querySelector('thead');
        const tableBody = table.querySelector('tbody');

        function populateFilterOptions(data, headerIndex) {
            const uniqueMetricTypes = [...new Set(data.map(row => row[headerIndex]))];
            uniqueMetricTypes.forEach(type => {
                const option = document.createElement('option');
                option.value = type;
                option.textContent = type;
                metricFilter.appendChild(option);
            });
        }

        // Populate table
        function populateTable(headers, rows, filterValue, headerIndex) {
            tableHead.innerHTML = '';
            tableBody.innerHTML = '';

            // Add headers dynamically
            const headerRow = document.createElement('tr');
            headers.forEach(header => {
                const th = document.createElement('th');
                th.textContent = header;
                headerRow.appendChild(th);
            });
            tableHead.appendChild(headerRow);

            // Add rows dynamically
            rows.filter(row => !filterValue || row[headerIndex] === filterValue)
                .forEach(row => {
                    const tr = document.createElement('tr');

                    row.forEach((value, index) => {
                        const td = document.createElement('td');
                        td.textContent = value;
                        td.classList.add('expandable');
                        td.title = 'Click to expand';
                        td.addEventListener('click', () => {
                            td.classList.toggle('expanded');
                        });
                        tr.appendChild(td);
                    });

                    tableBody.appendChild(tr);
                });
        }

        metricFilter.addEventListener('change', () => {
            const filterValue = metricFilter.value;
            populateTable(parsedCSV.headers, parsedCSV.rows, filterValue, 0); // Assuming Metric Type is the first column
        });

        // Initial load
        let parsedCSV;
        loadCSV('benchmark_overview_data.csv').then(({ headers, rows }) => {
            parsedCSV = { headers, rows };
            populateFilterOptions(rows, 0); // Assuming Metric Type is the first column
            populateTable(headers, rows, '', 0);
        });
    </script>
</body>
</html>