Spaces:
Runtime error
Runtime error
| from django.apps import AppConfig | |
| from rose_tts_hodc import TtsModelWrapper | |
| # import intel_extension_for_pytorch as ipex | |
| class TtsConfig(AppConfig): | |
| default_auto_field = 'django.db.models.BigAutoField' | |
| name = 'tts' | |
| models = {} | |
| def load_models(cls): | |
| for model_name in ['multispeaker', 'rose_perguntas']: | |
| model = cls.models.get(model_name) | |
| if model is None: | |
| model_path = 'models_ms/' + model_name + '.pth' | |
| model = TtsModelWrapper(model_path) | |
| # ipex.optimize(model.net_g, inplace=True) | |
| cls.models[model_name] = model | |
| def ready(self): | |
| TtsConfig.load_models() | |