diff --git a/website/_includes/_page_models.jade b/website/_includes/_page_models.jade index c5bd799f0..d4ce55f43 100644 --- a/website/_includes/_page_models.jade +++ b/website/_includes/_page_models.jade @@ -38,7 +38,7 @@ for id in CURRENT_MODELS +cell #[+label Size] +cell #[+tag=comps.size] #[span(data-tpl=id data-tpl-key="size") #[em n/a]] - each label in ["Pipeline", "Sources", "Author", "License"] + each label in ["Pipeline", "Vectors", "Sources", "Author", "License"] - var field = label.toLowerCase() +row +cell.u-nowrap diff --git a/website/assets/js/main.js b/website/assets/js/main.js index 42199538f..5cbd4d807 100644 --- a/website/assets/js/main.js +++ b/website/assets/js/main.js @@ -140,6 +140,10 @@ class ModelLoader { else return ({ ok: res.ok }) } + convertNumber(num, separator = ',') { + return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, separator); + } + getModels(compat) { this.compat = compat; for (let modelId of this.modelIds) { @@ -159,7 +163,7 @@ class ModelLoader { const template = new Templater(modelId); template.get('table').removeAttribute('data-loading'); template.get('error').style.display = 'block'; - for (let key of ['sources', 'pipeline', 'author', 'license']) { + for (let key of ['sources', 'pipeline', 'vectors', 'author', 'license']) { template.get(key).parentElement.parentElement.style.display = 'none'; } } @@ -167,13 +171,14 @@ class ModelLoader { /** * Update model details in tables. Currently quite hacky :( */ - render({ lang, name, version, sources, pipeline, url, author, license, accuracy, size, description, notes }) { + render({ lang, name, version, sources, pipeline, vectors, url, author, license, accuracy, size, description, notes }) { const modelId = `${lang}_${name}`; const model = `${modelId}-${version}`; const template = new Templater(modelId); const getSources = s => (s instanceof Array) ? s.join(', ') : s; const getPipeline = p => p.map(comp => `${comp}`).join(', '); + const getVectors = v => `${this.convertNumber(v.entries)} (${v.width} dimensions)`; const getLink = (t, l) => `${t}`; const keys = { version, size, description, notes } @@ -182,6 +187,8 @@ class ModelLoader { if (sources) template.fill('sources', getSources(sources)); if (pipeline && pipeline.length) template.fill('pipeline', getPipeline(pipeline), true); else template.get('pipeline').parentElement.parentElement.style.display = 'none'; + if (vectors) template.fill('vectors', getVectors(vectors)); + else template.get('vectors').parentElement.parentElement.style.display = 'none'; if (author) template.fill('author', url ? getLink(author, url) : author, true); if (license) template.fill('license', this.licenses[license] ? getLink(license, this.licenses[license]) : license, true);