fix(api): clearer error message when model doesn't support VC

This commit is contained in:
Enno Hermann 2024-11-29 16:17:02 +01:00
parent d488441b75
commit 6927e0bb89
1 changed files with 5 additions and 3 deletions

View File

@ -357,15 +357,17 @@ class TTS(nn.Module):
target_wav (str):` target_wav (str):`
Path to the target wav file. Path to the target wav file.
""" """
wav = self.voice_converter.voice_conversion(source_wav=source_wav, target_wav=target_wav) if self.voice_converter is None:
return wav msg = "The selected model does not support voice conversion."
raise RuntimeError(msg)
return self.voice_converter.voice_conversion(source_wav=source_wav, target_wav=target_wav)
def voice_conversion_to_file( def voice_conversion_to_file(
self, self,
source_wav: str, source_wav: str,
target_wav: str, target_wav: str,
file_path: str = "output.wav", file_path: str = "output.wav",
): ) -> str:
"""Voice conversion with FreeVC. Convert source wav to target speaker. """Voice conversion with FreeVC. Convert source wav to target speaker.
Args: Args: