Update app.py
Browse files
app.py
CHANGED
@@ -1,38 +1,47 @@
|
|
|
|
|
|
1 |
import re
|
2 |
import tempfile
|
3 |
from collections import OrderedDict
|
|
|
|
|
4 |
import click
|
5 |
import gradio as gr
|
6 |
import numpy as np
|
7 |
import soundfile as sf
|
8 |
import torchaudio
|
9 |
from cached_path import cached_path
|
10 |
-
from
|
11 |
-
|
12 |
-
from f5_tts.infer.utils_infer import (
|
13 |
-
load_vocoder,
|
14 |
-
load_model,
|
15 |
-
preprocess_ref_audio_text,
|
16 |
-
infer_process,
|
17 |
-
remove_silence_for_generated_wav,
|
18 |
-
save_spectrogram,
|
19 |
-
)
|
20 |
try:
|
21 |
import spaces
|
|
|
22 |
USING_SPACES = True
|
23 |
except ImportError:
|
24 |
USING_SPACES = False
|
25 |
|
26 |
|
27 |
-
import nltk
|
28 |
-
nltk.download('punkt_tab')
|
29 |
-
|
30 |
def gpu_decorator(func):
|
31 |
if USING_SPACES:
|
32 |
return spaces.GPU(func)
|
33 |
else:
|
34 |
return func
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
# Carregar vocoder
|
37 |
vocoder = load_vocoder()
|
38 |
|
|
|
1 |
+
|
2 |
+
from sentence_analyzer import SentenceAnalyzer
|
3 |
import re
|
4 |
import tempfile
|
5 |
from collections import OrderedDict
|
6 |
+
from importlib.resources import files
|
7 |
+
|
8 |
import click
|
9 |
import gradio as gr
|
10 |
import numpy as np
|
11 |
import soundfile as sf
|
12 |
import torchaudio
|
13 |
from cached_path import cached_path
|
14 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
15 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
try:
|
17 |
import spaces
|
18 |
+
|
19 |
USING_SPACES = True
|
20 |
except ImportError:
|
21 |
USING_SPACES = False
|
22 |
|
23 |
|
|
|
|
|
|
|
24 |
def gpu_decorator(func):
|
25 |
if USING_SPACES:
|
26 |
return spaces.GPU(func)
|
27 |
else:
|
28 |
return func
|
29 |
|
30 |
+
|
31 |
+
from f5_tts.model import DiT, UNetT
|
32 |
+
from f5_tts.infer.utils_infer import (
|
33 |
+
load_vocoder,
|
34 |
+
load_model,
|
35 |
+
preprocess_ref_audio_text,
|
36 |
+
infer_process,
|
37 |
+
remove_silence_for_generated_wav,
|
38 |
+
save_spectrogram,
|
39 |
+
)
|
40 |
+
|
41 |
+
import nltk
|
42 |
+
nltk.download('punkt_tab')
|
43 |
+
|
44 |
+
|
45 |
# Carregar vocoder
|
46 |
vocoder = load_vocoder()
|
47 |
|