benchmark_overview / index.html
UlrickBL's picture
Update index.html
263bc8d verified
raw
history blame
6.23 kB
<!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>