// Vue 3 Model Zoo Application const { createApp, ref, computed, onMounted, watch } = Vue; const { createRouter, createWebHashHistory, useRouter, useRoute } = VueRouter; // TagFilter Component const TagFilter = { props: ['activeTag', 'modelCounts'], emits: ['update:activeTag'], template: `
` }; // ModelCard Component const ModelCard = { props: ['model', 'modelId'], computed: { isMonaiBundle() { if (!this.model.download_url) return false; const isFromMonaiHF = this.model.download_url.includes('huggingface.co/MONAI'); const isVilaM3 = this.model.model_name && this.model.model_name.toLowerCase().includes('vila'); return isFromMonaiHF && !isVilaM3; } }, template: `

{{ model.model_name }}

v{{ model.version }}

{{ model.description }}

MONAI Bundle HuggingFace
View Details
` }; // Model List View const ModelListView = { components: { TagFilter, ModelCard }, setup() { const models = ref({}); const activeTag = ref('all'); const searchQuery = ref(''); const loading = ref(true); const error = ref(null); const isMonaiBundle = (model) => { if (!model.download_url) return false; // MONAI Bundle: from https://huggingface.co/MONAI but NOT VILA-M3 models const isFromMonaiHF = model.download_url.includes('huggingface.co/MONAI'); const isVilaM3 = model.model_name && model.model_name.toLowerCase().includes('vila'); return isFromMonaiHF && !isVilaM3; }; const filteredModels = computed(() => { if (!models.value || Object.keys(models.value).length === 0) return []; return Object.entries(models.value).filter(([modelId, model]) => { // First filter by tag if (activeTag.value !== 'all') { const isBundle = isMonaiBundle(model); if (activeTag.value === 'bundle' && !isBundle) return false; if (activeTag.value === 'hf' && isBundle) return false; } // Then filter by search query if (searchQuery.value.trim()) { const query = searchQuery.value.toLowerCase(); const nameMatch = model.model_name && model.model_name.toLowerCase().includes(query); const descMatch = model.description && model.description.toLowerCase().includes(query); const idMatch = modelId.toLowerCase().includes(query); return nameMatch || descMatch || idMatch; } return true; }); }); const modelCounts = computed(() => { if (!models.value) return { total: 0, bundle: 0, hf: 0 }; // Filter models by search query first const searchFiltered = Object.entries(models.value).filter(([modelId, model]) => { if (!searchQuery.value.trim()) return true; const query = searchQuery.value.toLowerCase(); const nameMatch = model.model_name && model.model_name.toLowerCase().includes(query); const descMatch = model.description && model.description.toLowerCase().includes(query); const idMatch = modelId.toLowerCase().includes(query); return nameMatch || descMatch || idMatch; }); // Then count by type const searchFilteredModels = searchFiltered.map(([_, model]) => model); const bundleModels = searchFilteredModels.filter(m => isMonaiBundle(m)); const hfModels = searchFilteredModels.filter(m => !isMonaiBundle(m)); return { total: searchFilteredModels.length, bundle: bundleModels.length, hf: hfModels.length }; }); onMounted(async () => { try { const response = await fetch('model_data.json'); if (!response.ok) throw new Error('Failed to fetch model data'); models.value = await response.json(); } catch (err) { error.value = err.message; } finally { loading.value = false; } }); return { models, activeTag, searchQuery, loading, error, filteredModels, modelCounts }; }, template: `

MONAI Model Zoo

Discover and download state-of-the-art medical imaging models in the MONAI Bundle format.

The MONAI Model Zoo is a collection of pre-trained medical imaging models, ready for research and clinical deployment. Each model is packaged in the MONAI Bundle format, ensuring reproducibility and ease of use.

Our models cover a wide range of medical imaging tasks, from segmentation to classification, and are validated through rigorous testing and real-world applications. Whether you're a researcher, clinician, or developer, you'll find models that can accelerate your medical AI journey.

Loading models...

Error loading models: {{ error }}

Browse Models

Search and filter to find the models you need

No models found

Try adjusting your search or filter criteria

` }; // Model Detail View const ModelDetailView = { setup() { const route = useRoute(); const router = useRouter(); const model = ref(null); const loading = ref(true); const error = ref(null); // Function to clean up HuggingFace model readmes const cleanReadme = (readme) => { if (!readme) return readme; // Remove YAML frontmatter (everything between --- or between first
tags with metadata) let cleaned = readme; // Pattern 1: Remove content between
tags that contains license/tags cleaned = cleaned.replace(/\s*

license:[\s\S]*?<\/p>\s*/i, ''); // Pattern 2: Remove YAML frontmatter between --- markers cleaned = cleaned.replace(/^---[\s\S]*?---\s*/m, ''); return cleaned.trim(); }; onMounted(async () => { // Scroll to top when component mounts window.scrollTo(0, 0); try { const response = await fetch('model_data.json'); if (!response.ok) throw new Error('Failed to fetch model data'); const data = await response.json(); const modelId = route.params.id; if (data[modelId]) { model.value = data[modelId]; // Clean up the readme if it exists if (model.value.readme) { model.value.readme = cleanReadme(model.value.readme); } } else { throw new Error('Model not found'); } } catch (err) { error.value = err.message; } finally { loading.value = false; } }); const goBack = () => { router.push('/'); }; return { model, loading, error, goBack }; }, template: `

Loading model details...

{{ error }}

{{ model.model_name }}

{{ model.description }}

Model Information

Authors

{{ model.authors }}

Version

{{ model.version }}

Type

{{ ((model.download_url || model.huggingface_url).includes('huggingface.co/MONAI') && !model.model_name.toLowerCase().includes('vila')) ? 'MONAI Bundle' : 'HuggingFace Model' }}

References

  • {{ paper }}

Version History

v{{ version }}

{{ changes }}

Documentation

` }; // Router configuration const routes = [ { path: '/', component: ModelListView }, { path: '/model/:id', component: ModelDetailView } ]; const router = createRouter({ history: createWebHashHistory(), routes }); // Main App const app = createApp({ template: `
` }); app.use(router); app.mount('#app');