Spaces:
Sleeping
Sleeping
Download example_vc.py from bo0o0o/chatterbox: direct link, hf CLI and curl.
- Browser
- Download file 555 Bytes
-
https://huggingface.co/spaces/bo0o0o/chatterbox/resolve/main/example_vc.py
- Command line
-
hf download hf://spaces/bo0o0o/chatterbox/example_vc.py
-
curl -L -o example_vc.py https://huggingface.co/spaces/bo0o0o/chatterbox/resolve/main/example_vc.py
555 Bytes
| import torch | |
| import torchaudio as ta | |
| from chatterbox.vc import ChatterboxVC | |
| # Automatically detect the best available device | |
| if torch.cuda.is_available(): | |
| device = "cuda" | |
| elif torch.backends.mps.is_available(): | |
| device = "mps" | |
| else: | |
| device = "cpu" | |
| print(f"Using device: {device}") | |
| AUDIO_PATH = "YOUR_FILE.wav" | |
| TARGET_VOICE_PATH = "YOUR_FILE.wav" | |
| model = ChatterboxVC.from_pretrained(device) | |
| wav = model.generate( | |
| audio=AUDIO_PATH, | |
| target_voice_path=TARGET_VOICE_PATH, | |
| ) | |
| ta.save("testvc.wav", wav, model.sr) | |