Initial commit

This commit is contained in:
Will Miao
2025-01-25 19:22:02 +08:00
commit ad6137d355
13 changed files with 1069 additions and 0 deletions

22
utils/model_utils.py Normal file
View File

@@ -0,0 +1,22 @@
from typing import Dict, Optional
# Base model mapping based on version string
BASE_MODEL_MAPPING = {
"sd-v1-5": "SD1.5",
"sd-v2-1": "SD2.1",
"sdxl": "SDXL",
"sd-v2": "SD2.0",
"flux1": "Flux1.D",
}
def determine_base_model(version_string: Optional[str]) -> str:
"""Determine base model from version string in safetensors metadata"""
if not version_string:
return "Unknown"
version_lower = version_string.lower()
for key, value in BASE_MODEL_MAPPING.items():
if key in version_lower:
return value
return "Unknown"