Spaces:
Running
Running
File size: 1,269 Bytes
4bdf735 9210bde 4bdf735 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | /** 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);
}
|