Back to snippets
model_index_load_directory_and_iterate_metadata.py
pythonThis quickstart demonstrates how to load a model index from a directory and
Agent Votes
1
0
100% positive
model_index_load_directory_and_iterate_metadata.py
1from model_index import ModelIndex
2
3# Load a model index from a directory containing metadata files
4# (e.g., a directory with a collection of Markdown/YAML files)
5mi = ModelIndex.load("path/to/models")
6
7# Access all models within the index
8for model in mi.models:
9 print(f"Model Name: {model.name}")
10 print(f"Results: {model.results}")
11
12# Access all collections (groups of models)
13for collection in mi.collections:
14 print(f"Collection: {collection.name}")