Spaces:
Paused
Paused
Commit
·
29c7e98
1
Parent(s):
b86caaa
feat: replace torchaudio with torchcodec for audio decoding
Browse files- app.py +2 -2
- requirements.txt +1 -0
app.py
CHANGED
|
@@ -4,7 +4,7 @@ from importlib.resources import files
|
|
| 4 |
import gradio as gr
|
| 5 |
import soundfile as sf
|
| 6 |
import torch
|
| 7 |
-
import
|
| 8 |
from cached_path import cached_path
|
| 9 |
from omegaconf import OmegaConf
|
| 10 |
|
|
@@ -164,7 +164,7 @@ def infer(
|
|
| 164 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as f:
|
| 165 |
sf.write(f.name, final_wave, final_sample_rate)
|
| 166 |
remove_silence_for_generated_wav(f.name)
|
| 167 |
-
final_wave
|
| 168 |
final_wave = final_wave.squeeze().cpu().numpy()
|
| 169 |
|
| 170 |
# Save the spectrogram
|
|
|
|
| 4 |
import gradio as gr
|
| 5 |
import soundfile as sf
|
| 6 |
import torch
|
| 7 |
+
import torchcodec
|
| 8 |
from cached_path import cached_path
|
| 9 |
from omegaconf import OmegaConf
|
| 10 |
|
|
|
|
| 164 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as f:
|
| 165 |
sf.write(f.name, final_wave, final_sample_rate)
|
| 166 |
remove_silence_for_generated_wav(f.name)
|
| 167 |
+
final_wave = torchcodec.decoders.AudioDecoder(f.name).get_all_samples().data
|
| 168 |
final_wave = final_wave.squeeze().cpu().numpy()
|
| 169 |
|
| 170 |
# Save the spectrogram
|
requirements.txt
CHANGED
|
@@ -1,3 +1,4 @@
|
|
| 1 |
omegaconf
|
| 2 |
opencc
|
|
|
|
| 3 |
git+https://github.com/SWivid/F5-TTS.git
|
|
|
|
| 1 |
omegaconf
|
| 2 |
opencc
|
| 3 |
+
torchcodec
|
| 4 |
git+https://github.com/SWivid/F5-TTS.git
|