Spaces:
Configuration error
Configuration error
tweak api.py
Browse files- src/f5_tts/api.py +12 -5
src/f5_tts/api.py
CHANGED
|
@@ -1,14 +1,21 @@
|
|
| 1 |
import random
|
| 2 |
import sys
|
| 3 |
import tqdm
|
|
|
|
| 4 |
|
| 5 |
import soundfile as sf
|
| 6 |
import torch
|
| 7 |
from cached_path import cached_path
|
| 8 |
|
| 9 |
from f5_tts.model import DiT, UNetT
|
| 10 |
-
from f5_tts.model.utils import seed_everything
|
| 11 |
-
from f5_tts.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
class F5TTS:
|
|
@@ -120,11 +127,11 @@ if __name__ == "__main__":
|
|
| 120 |
f5tts = F5TTS()
|
| 121 |
|
| 122 |
wav, sr, spect = f5tts.infer(
|
| 123 |
-
ref_file="
|
| 124 |
ref_text="some call me nature, others call me mother nature.",
|
| 125 |
gen_text="""I don't really care what you call me. I've been a silent spectator, watching species evolve, empires rise and fall. But always remember, I am mighty and enduring. Respect me and I'll nurture you; ignore me and you shall face the consequences.""",
|
| 126 |
-
file_wave="
|
| 127 |
-
file_spect="
|
| 128 |
seed=-1, # random seed = -1
|
| 129 |
)
|
| 130 |
|
|
|
|
| 1 |
import random
|
| 2 |
import sys
|
| 3 |
import tqdm
|
| 4 |
+
from importlib.resources import files
|
| 5 |
|
| 6 |
import soundfile as sf
|
| 7 |
import torch
|
| 8 |
from cached_path import cached_path
|
| 9 |
|
| 10 |
from f5_tts.model import DiT, UNetT
|
| 11 |
+
from f5_tts.model.utils import seed_everything
|
| 12 |
+
from f5_tts.infer.utils_infer import (
|
| 13 |
+
load_vocoder,
|
| 14 |
+
load_model,
|
| 15 |
+
infer_process,
|
| 16 |
+
remove_silence_for_generated_wav,
|
| 17 |
+
save_spectrogram,
|
| 18 |
+
)
|
| 19 |
|
| 20 |
|
| 21 |
class F5TTS:
|
|
|
|
| 127 |
f5tts = F5TTS()
|
| 128 |
|
| 129 |
wav, sr, spect = f5tts.infer(
|
| 130 |
+
ref_file=str(files("f5_tts").joinpath("infer/examples/basic/basic_ref_en.wav")),
|
| 131 |
ref_text="some call me nature, others call me mother nature.",
|
| 132 |
gen_text="""I don't really care what you call me. I've been a silent spectator, watching species evolve, empires rise and fall. But always remember, I am mighty and enduring. Respect me and I'll nurture you; ignore me and you shall face the consequences.""",
|
| 133 |
+
file_wave=str(files("f5_tts").joinpath("../../api_test_out.wav")),
|
| 134 |
+
file_spect=str(files("f5_tts").joinpath("../../api_test_out.png")),
|
| 135 |
seed=-1, # random seed = -1
|
| 136 |
)
|
| 137 |
|