Spaces:
Running
Running
Anonymous commited on
Commit ·
bede684
1
Parent(s): 4711156
Use stacked case cards for all model audio
Browse files- index.html +30 -58
- static/css/index.css +20 -72
index.html
CHANGED
|
@@ -156,90 +156,62 @@
|
|
| 156 |
}[char]));
|
| 157 |
}
|
| 158 |
|
| 159 |
-
function
|
| 160 |
-
const
|
| 161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
|
| 163 |
const body = document.createElement("div");
|
| 164 |
-
body.className = "
|
| 165 |
if (content) {
|
| 166 |
body.appendChild(content);
|
| 167 |
}
|
| 168 |
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
function createHeaderCell(label) {
|
| 174 |
-
const cell = document.createElement("div");
|
| 175 |
-
cell.className = "case-header-cell";
|
| 176 |
-
cell.textContent = label;
|
| 177 |
-
return cell;
|
| 178 |
-
}
|
| 179 |
-
|
| 180 |
-
function createCaseHeader(task) {
|
| 181 |
-
const header = document.createElement("div");
|
| 182 |
-
header.className = "case-header";
|
| 183 |
-
header.appendChild(createHeaderCell("Script"));
|
| 184 |
-
|
| 185 |
-
const headerScroll = document.createElement("div");
|
| 186 |
-
headerScroll.className = "case-header-scroll";
|
| 187 |
-
const headerGrid = document.createElement("div");
|
| 188 |
-
headerGrid.className = "case-grid";
|
| 189 |
-
headerGrid.style.setProperty("--model-count", task.models.length);
|
| 190 |
-
|
| 191 |
-
if (task.show_reference) {
|
| 192 |
-
headerGrid.appendChild(createHeaderCell("Reference"));
|
| 193 |
-
}
|
| 194 |
-
|
| 195 |
-
task.models.forEach((model) => {
|
| 196 |
-
headerGrid.appendChild(createHeaderCell(model));
|
| 197 |
-
});
|
| 198 |
-
|
| 199 |
-
headerScroll.appendChild(headerGrid);
|
| 200 |
-
header.appendChild(headerScroll);
|
| 201 |
-
return header;
|
| 202 |
}
|
| 203 |
|
| 204 |
function renderTable(task, manifests, taskRoot) {
|
| 205 |
const wrapper = document.createElement("div");
|
| 206 |
-
wrapper.className =
|
| 207 |
-
wrapper.appendChild(createCaseHeader(task));
|
| 208 |
-
const headerScroll = wrapper.querySelector(".case-header-scroll");
|
| 209 |
|
| 210 |
manifests[task.models[0]].forEach((item) => {
|
| 211 |
-
const
|
| 212 |
-
|
| 213 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
|
| 215 |
-
const
|
| 216 |
-
|
| 217 |
-
const caseGrid = document.createElement("div");
|
| 218 |
-
caseGrid.className = "case-grid";
|
| 219 |
-
caseGrid.style.setProperty("--model-count", task.models.length);
|
| 220 |
|
| 221 |
if (task.show_reference) {
|
| 222 |
const modelRoot = `${taskRoot}/${task.models[0]}`;
|
| 223 |
-
|
| 224 |
}
|
| 225 |
|
| 226 |
task.models.forEach((model) => {
|
| 227 |
const modelItem = manifests[model].find((entry) => entry.utt === item.utt);
|
| 228 |
const content = document.createElement("div");
|
| 229 |
-
content.className = "audio-
|
| 230 |
if (modelItem) {
|
| 231 |
content.appendChild(createAudio(`${taskRoot}/${model}/${modelItem.output_audio}`));
|
| 232 |
}
|
| 233 |
-
|
| 234 |
});
|
| 235 |
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
wrapper.appendChild(caseRow);
|
| 239 |
-
|
| 240 |
-
caseScroll.addEventListener("scroll", () => {
|
| 241 |
-
headerScroll.scrollLeft = caseScroll.scrollLeft;
|
| 242 |
-
});
|
| 243 |
});
|
| 244 |
|
| 245 |
return wrapper;
|
|
|
|
| 156 |
}[char]));
|
| 157 |
}
|
| 158 |
|
| 159 |
+
function createAudioCard(label, content) {
|
| 160 |
+
const card = document.createElement("div");
|
| 161 |
+
card.className = "audio-card";
|
| 162 |
+
|
| 163 |
+
const title = document.createElement("div");
|
| 164 |
+
title.className = "audio-card-title";
|
| 165 |
+
title.textContent = label;
|
| 166 |
|
| 167 |
const body = document.createElement("div");
|
| 168 |
+
body.className = "audio-card-body";
|
| 169 |
if (content) {
|
| 170 |
body.appendChild(content);
|
| 171 |
}
|
| 172 |
|
| 173 |
+
card.appendChild(title);
|
| 174 |
+
card.appendChild(body);
|
| 175 |
+
return card;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
}
|
| 177 |
|
| 178 |
function renderTable(task, manifests, taskRoot) {
|
| 179 |
const wrapper = document.createElement("div");
|
| 180 |
+
wrapper.className = "demo-cases";
|
|
|
|
|
|
|
| 181 |
|
| 182 |
manifests[task.models[0]].forEach((item) => {
|
| 183 |
+
const caseBlock = document.createElement("article");
|
| 184 |
+
caseBlock.className = "case-block";
|
| 185 |
+
|
| 186 |
+
const scriptBlock = document.createElement("div");
|
| 187 |
+
scriptBlock.className = "case-script";
|
| 188 |
+
const scriptTitle = document.createElement("div");
|
| 189 |
+
scriptTitle.className = "case-section-title";
|
| 190 |
+
scriptTitle.textContent = "Script";
|
| 191 |
+
scriptBlock.appendChild(scriptTitle);
|
| 192 |
+
scriptBlock.appendChild(createScriptCell(item));
|
| 193 |
+
caseBlock.appendChild(scriptBlock);
|
| 194 |
|
| 195 |
+
const audioGrid = document.createElement("div");
|
| 196 |
+
audioGrid.className = "audio-grid";
|
|
|
|
|
|
|
|
|
|
| 197 |
|
| 198 |
if (task.show_reference) {
|
| 199 |
const modelRoot = `${taskRoot}/${task.models[0]}`;
|
| 200 |
+
audioGrid.appendChild(createAudioCard("Reference", createReferenceCell(item, modelRoot)));
|
| 201 |
}
|
| 202 |
|
| 203 |
task.models.forEach((model) => {
|
| 204 |
const modelItem = manifests[model].find((entry) => entry.utt === item.utt);
|
| 205 |
const content = document.createElement("div");
|
| 206 |
+
content.className = "audio-card-content";
|
| 207 |
if (modelItem) {
|
| 208 |
content.appendChild(createAudio(`${taskRoot}/${model}/${modelItem.output_audio}`));
|
| 209 |
}
|
| 210 |
+
audioGrid.appendChild(createAudioCard(model, content));
|
| 211 |
});
|
| 212 |
|
| 213 |
+
caseBlock.appendChild(audioGrid);
|
| 214 |
+
wrapper.appendChild(caseBlock);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 215 |
});
|
| 216 |
|
| 217 |
return wrapper;
|
static/css/index.css
CHANGED
|
@@ -168,91 +168,51 @@ body {
|
|
| 168 |
|
| 169 |
.demo-cases {
|
| 170 |
display: grid;
|
|
|
|
| 171 |
padding: 0.9rem;
|
| 172 |
background: var(--paper);
|
| 173 |
}
|
| 174 |
|
| 175 |
-
.case-
|
| 176 |
-
display: grid;
|
| 177 |
-
grid-template-columns: minmax(24rem, 30rem) minmax(0, 1fr);
|
| 178 |
border: 1px solid var(--line);
|
| 179 |
-
background: var(--
|
| 180 |
}
|
| 181 |
|
| 182 |
-
.case-
|
| 183 |
-
|
| 184 |
-
|
|
|
|
| 185 |
}
|
| 186 |
|
| 187 |
-
.case-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
padding: 0.65rem 0.75rem;
|
| 191 |
color: var(--ink);
|
| 192 |
font-size: 0.86rem;
|
| 193 |
font-weight: 700;
|
| 194 |
-
text-align: center;
|
| 195 |
-
}
|
| 196 |
-
|
| 197 |
-
.case-header-cell:last-child {
|
| 198 |
-
border-right: 0;
|
| 199 |
}
|
| 200 |
|
| 201 |
-
.
|
| 202 |
display: grid;
|
| 203 |
-
grid-template-columns:
|
| 204 |
-
|
| 205 |
-
border-bottom: 1px solid var(--line);
|
| 206 |
-
border-left: 1px solid var(--line);
|
| 207 |
-
background: #fbfbfb;
|
| 208 |
-
}
|
| 209 |
-
|
| 210 |
-
.case-scroll {
|
| 211 |
-
overflow-x: auto;
|
| 212 |
-
border-left: 1px solid var(--line);
|
| 213 |
}
|
| 214 |
|
| 215 |
-
.
|
| 216 |
display: grid;
|
| 217 |
-
|
| 218 |
-
min-
|
| 219 |
-
height: 100%;
|
| 220 |
-
}
|
| 221 |
-
|
| 222 |
-
.demo-cases.without-reference .case-grid {
|
| 223 |
-
grid-template-columns: repeat(var(--model-count), 20rem);
|
| 224 |
-
}
|
| 225 |
-
|
| 226 |
-
.case-cell {
|
| 227 |
-
display: flex;
|
| 228 |
-
min-width: 0;
|
| 229 |
border-right: 1px solid var(--line);
|
| 230 |
-
|
| 231 |
-
}
|
| 232 |
-
|
| 233 |
-
.case-cell:last-child {
|
| 234 |
-
border-right: 0;
|
| 235 |
-
}
|
| 236 |
-
|
| 237 |
-
.case-cell-body {
|
| 238 |
-
display: flex;
|
| 239 |
-
width: 100%;
|
| 240 |
-
align-items: center;
|
| 241 |
padding: 0.85rem;
|
|
|
|
| 242 |
}
|
| 243 |
|
| 244 |
-
.audio-
|
| 245 |
width: 100%;
|
| 246 |
}
|
| 247 |
|
| 248 |
-
.script-case .case-cell-body {
|
| 249 |
-
align-items: flex-start;
|
| 250 |
-
}
|
| 251 |
-
|
| 252 |
.script-cell {
|
| 253 |
-
max-height: 17rem;
|
| 254 |
-
overflow: auto;
|
| 255 |
-
padding-right: 0.25rem;
|
| 256 |
color: #202020;
|
| 257 |
font-size: 0.92rem;
|
| 258 |
line-height: 1.5;
|
|
@@ -266,13 +226,9 @@ body {
|
|
| 266 |
margin-bottom: 0;
|
| 267 |
}
|
| 268 |
|
| 269 |
-
.script-cell strong {
|
| 270 |
-
font-weight: 700;
|
| 271 |
-
}
|
| 272 |
-
|
| 273 |
.reference-cell {
|
| 274 |
display: grid;
|
| 275 |
-
gap: 0.
|
| 276 |
}
|
| 277 |
|
| 278 |
.reference-cell span {
|
|
@@ -307,12 +263,4 @@ audio {
|
|
| 307 |
.task-directory {
|
| 308 |
grid-template-columns: 1fr;
|
| 309 |
}
|
| 310 |
-
|
| 311 |
-
.case-header {
|
| 312 |
-
grid-template-columns: minmax(18rem, 22rem) minmax(0, 1fr);
|
| 313 |
-
}
|
| 314 |
-
|
| 315 |
-
.case-row {
|
| 316 |
-
grid-template-columns: minmax(18rem, 22rem) minmax(0, 1fr);
|
| 317 |
-
}
|
| 318 |
}
|
|
|
|
| 168 |
|
| 169 |
.demo-cases {
|
| 170 |
display: grid;
|
| 171 |
+
gap: 1rem;
|
| 172 |
padding: 0.9rem;
|
| 173 |
background: var(--paper);
|
| 174 |
}
|
| 175 |
|
| 176 |
+
.case-block {
|
|
|
|
|
|
|
| 177 |
border: 1px solid var(--line);
|
| 178 |
+
background: var(--paper);
|
| 179 |
}
|
| 180 |
|
| 181 |
+
.case-script {
|
| 182 |
+
border-bottom: 1px solid var(--line);
|
| 183 |
+
padding: 0.9rem 1rem;
|
| 184 |
+
background: #fbfbfb;
|
| 185 |
}
|
| 186 |
|
| 187 |
+
.case-section-title,
|
| 188 |
+
.audio-card-title {
|
| 189 |
+
margin-bottom: 0.45rem;
|
|
|
|
| 190 |
color: var(--ink);
|
| 191 |
font-size: 0.86rem;
|
| 192 |
font-weight: 700;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 193 |
}
|
| 194 |
|
| 195 |
+
.audio-grid {
|
| 196 |
display: grid;
|
| 197 |
+
grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
|
| 198 |
+
gap: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
}
|
| 200 |
|
| 201 |
+
.audio-card {
|
| 202 |
display: grid;
|
| 203 |
+
align-content: center;
|
| 204 |
+
min-height: 6.2rem;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
border-right: 1px solid var(--line);
|
| 206 |
+
border-bottom: 1px solid var(--line);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 207 |
padding: 0.85rem;
|
| 208 |
+
background: var(--paper);
|
| 209 |
}
|
| 210 |
|
| 211 |
+
.audio-card-content {
|
| 212 |
width: 100%;
|
| 213 |
}
|
| 214 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 215 |
.script-cell {
|
|
|
|
|
|
|
|
|
|
| 216 |
color: #202020;
|
| 217 |
font-size: 0.92rem;
|
| 218 |
line-height: 1.5;
|
|
|
|
| 226 |
margin-bottom: 0;
|
| 227 |
}
|
| 228 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
.reference-cell {
|
| 230 |
display: grid;
|
| 231 |
+
gap: 0.55rem;
|
| 232 |
}
|
| 233 |
|
| 234 |
.reference-cell span {
|
|
|
|
| 263 |
.task-directory {
|
| 264 |
grid-template-columns: 1fr;
|
| 265 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 266 |
}
|