INNER CODE UNIT · Python
scan_custom_models
virajmavani/semi-auto-image-annotation-tool · web/backend/main.py:80
def scan_custom_models():
"""Scan snapshots directory for custom models"""
if not SNAPSHOTS_DIR.exists():
return
# Scan for Keras models
keras_dir = SNAPSHOTS_DIR / "keras"
if keras_dir.exists():
for model_file in keras_dir.glob("*.h5"):
model_id = f"keras_{model_file.stem}"
AVAILABLE_MODELS[model_id] = {
"name": f"Custom Keras: {model_file.stem}",
"description": f"Keras model from {model_file.name}",
"type": "keras",
"weights_path": str(model_file),
"framework": "keras"
}