webgpu-cluster / shared /clusterModels.ts
apssouza22's picture
Deploy: refresh Space build (landing + docs)
9210bde verified
Raw
History Blame Contribute Delete
1.27 kB
/** Models a browser host can expose to the cluster. Add entries as new workers are wired up. */
export interface ClusterModelDefinition {
id: string;
label: string;
description: string;
/** When false, the host UI shows the option but cannot start hosting yet. */
implemented: boolean;
}
export const CLUSTER_MODELS: readonly ClusterModelDefinition[] = [
{
id: 'rfdetr-medium',
label: 'Object detection',
description: 'RF-DETR Medium (COCO) on WebGPU',
implemented: true,
},
{
id: 'smolvlm-500m',
label: 'Video description',
description: 'SmolVLM-500M-Instruct vision-language model on WebGPU',
implemented: true,
},
] as const;
export const OBJECT_DETECTION_MODEL_ID = 'rfdetr-medium';
export const VIDEO_DESCRIPTION_MODEL_ID = 'smolvlm-500m';
export const DEFAULT_CLUSTER_MODEL_ID = CLUSTER_MODELS[0].id;
export function getClusterModel(id: string): ClusterModelDefinition | undefined {
return CLUSTER_MODELS.find((model) => model.id === id);
}
export function isValidClusterModelId(id: string): boolean {
return CLUSTER_MODELS.some((model) => model.id === id);
}
export function isImplementedClusterModel(id: string): boolean {
const model = getClusterModel(id);
return Boolean(model?.implemented);
}