| import sys | |
| import json | |
| from pathlib import Path | |
| ROOT = Path(__file__).parent | |
| # Add local VoxCPM src directory to sys.path | |
| sys.path.insert(0, str(ROOT / "VoxCPM" / "src")) | |
| from voxcpm.core import VoxCPM | |
| from voxcpm.model.voxcpm import LoRAConfig | |
| def load_menstrual_bangla_tts(local_path: str): | |
| root = Path(local_path) | |
| with open(root / "lora" / "lora_config.json") as f: | |
| lora_info = json.load(f) | |
| lora_cfg = LoRAConfig(**lora_info["lora_config"]) | |
| model = VoxCPM.from_pretrained( | |
| hf_model_id=str(root), | |
| lora_config=lora_cfg, | |
| lora_weights_path=str(root / "lora"), | |
| load_denoiser=False, | |
| ) | |
| return model | |