Spaces:
Runtime error
Runtime error
| from tortoise.api import TextToSpeech | |
| from tortoise.utils.audio import load_voice | |
| import torchaudio | |
| # Create TTS instance | |
| tts = TextToSpeech() | |
| # Load prebuilt voice profile | |
| voice_samples, conditioning_latents = load_voice('train_dotrice') | |
| # Run TTS | |
| output = tts.tts_with_preset( | |
| text="This is a test from Tortoise Text to Speech running correctly on Python 3.10.", | |
| voice_samples=voice_samples, | |
| conditioning_latents=conditioning_latents, | |
| preset='fast' | |
| ) | |
| # Save output using torchaudio directly | |
| torchaudio.save("output.wav", output.squeeze(0).cpu(), 24000) # 24kHz sample rate | |
| print("✅ Audio saved to output.wav") | |