diff --git a/common/css/style.css b/common/css/style.css index 72564d1e..63096fd8 100644 --- a/common/css/style.css +++ b/common/css/style.css @@ -823,4 +823,8 @@ a:hover { #footer a { display: inline-block; +} + +.nowrap { + white-space: nowrap; } \ No newline at end of file diff --git a/common/utils.js b/common/utils.js index 6e87f07a..fc438d0a 100644 --- a/common/utils.js +++ b/common/utils.js @@ -561,3 +561,30 @@ export function getDefaultLayout(deviceType) { } } } + +/** + * Display available models based on device type and data type. + * @param {Object} modelList list of available models. + * @param {Array} modelIds list of model ids. + * @param {String} deviceType 'cpu', 'gpu' or 'npu'. + * @param {String} dataType 'float32', 'float16', or ''. + */ +export function displayAvailableModels(modelList, modelIds, deviceType, dataType) { + let models = []; + if (dataType == '') { + models = models.concat(modelList[deviceType]['float32']); + models = models.concat(modelList[deviceType]['float16']); + } else { + models = models.concat(modelList[deviceType][dataType]); + } + // Remove duplicate ids. + models = [...new Set(models)]; + // Display available models. + for (const modelId of modelIds) { + if (models.includes(modelId)) { + $(`#${modelId}`).parent().show(); + } else { + $(`#${modelId}`).parent().hide(); + } + } +} \ No newline at end of file diff --git a/image_classification/index.html b/image_classification/index.html index fc9a0d43..85f3b87f 100644 --- a/image_classification/index.html +++ b/image_classification/index.html @@ -66,7 +66,7 @@ -->