fix
Browse files- app.py +43 -5
- logs/sentence_analyzer_2024-12-02.log +10 -0
app.py
CHANGED
@@ -70,9 +70,47 @@ training_process = None # Adicione esta linha se necessário para o seu context
|
|
70 |
class F5TTS(F5TTS): # Herdando da classe original F5TTS
|
71 |
def infer(
|
72 |
self,
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
):
|
75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
|
77 |
# Salvar o áudio em um arquivo temporário
|
78 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as f:
|
@@ -82,7 +120,8 @@ class F5TTS(F5TTS): # Herdando da classe original F5TTS
|
|
82 |
# Retornar o caminho do arquivo temporário
|
83 |
return audio_file, self.device, str(self.seed)
|
84 |
|
85 |
-
|
|
|
86 |
with gr.Tabs():
|
87 |
with gr.Tab("TTS Básico"):
|
88 |
gr.Markdown("# TTS Básico com F5-TTS")
|
@@ -219,8 +258,7 @@ with gr.Blocks() as app: # Removido o CSS customizado
|
|
219 |
seed_output,
|
220 |
],
|
221 |
)
|
222 |
-
|
223 |
-
|
224 |
# Código para iniciar a aplicação Gradio
|
225 |
@click.command()
|
226 |
@click.option("--port", "-p", default=None, type=int, help="Port to run the app on")
|
|
|
70 |
class F5TTS(F5TTS): # Herdando da classe original F5TTS
|
71 |
def infer(
|
72 |
self,
|
73 |
+
ref_file,
|
74 |
+
ref_text,
|
75 |
+
gen_text,
|
76 |
+
show_info=print,
|
77 |
+
progress=tqdm,
|
78 |
+
target_rms=0.1,
|
79 |
+
cross_fade_duration=0.15,
|
80 |
+
sway_sampling_coef=-1,
|
81 |
+
cfg_strength=2,
|
82 |
+
nfe_step=32,
|
83 |
+
speed=1.0,
|
84 |
+
fix_duration=None,
|
85 |
+
remove_silence=False,
|
86 |
+
file_wave=None,
|
87 |
+
file_spect=None,
|
88 |
+
seed=-1,
|
89 |
):
|
90 |
+
if seed == -1:
|
91 |
+
seed = random.randint(0, sys.maxsize)
|
92 |
+
seed_everything(seed)
|
93 |
+
self.seed = seed
|
94 |
+
wav, sr, spect = infer_process( # Chamando infer_process
|
95 |
+
ref_file,
|
96 |
+
ref_text,
|
97 |
+
gen_text,
|
98 |
+
self.ema_model,
|
99 |
+
show_info=show_info,
|
100 |
+
progress=progress,
|
101 |
+
target_rms=target_rms,
|
102 |
+
cross_fade_duration=cross_fade_duration,
|
103 |
+
nfe_step=nfe_step,
|
104 |
+
cfg_strength=cfg_strength,
|
105 |
+
sway_sampling_coef=sway_sampling_coef,
|
106 |
+
speed=speed,
|
107 |
+
fix_duration=fix_duration,
|
108 |
+
device=self.device,
|
109 |
+
)
|
110 |
+
if file_wave is not None:
|
111 |
+
self.export_wav(wav, file_wave, remove_silence)
|
112 |
+
if file_spect is not None:
|
113 |
+
self.export_spectrogram(spect, file_spect)
|
114 |
|
115 |
# Salvar o áudio em um arquivo temporário
|
116 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as f:
|
|
|
120 |
# Retornar o caminho do arquivo temporário
|
121 |
return audio_file, self.device, str(self.seed)
|
122 |
|
123 |
+
|
124 |
+
with gr.Blocks() as app:
|
125 |
with gr.Tabs():
|
126 |
with gr.Tab("TTS Básico"):
|
127 |
gr.Markdown("# TTS Básico com F5-TTS")
|
|
|
258 |
seed_output,
|
259 |
],
|
260 |
)
|
261 |
+
|
|
|
262 |
# Código para iniciar a aplicação Gradio
|
263 |
@click.command()
|
264 |
@click.option("--port", "-p", default=None, type=int, help="Port to run the app on")
|
logs/sentence_analyzer_2024-12-02.log
CHANGED
@@ -66,3 +66,13 @@
|
|
66 |
2024-12-02 20:40:49,341 - SentenceAnalyzer - DEBUG - Normalized whitespace
|
67 |
2024-12-02 20:40:49,364 - SentenceAnalyzer - DEBUG - Split text into 1 sentences using NLTK
|
68 |
2024-12-02 20:40:49,364 - SentenceAnalyzer - INFO - Split text into 1 sentences after cleanup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
2024-12-02 20:40:49,341 - SentenceAnalyzer - DEBUG - Normalized whitespace
|
67 |
2024-12-02 20:40:49,364 - SentenceAnalyzer - DEBUG - Split text into 1 sentences using NLTK
|
68 |
2024-12-02 20:40:49,364 - SentenceAnalyzer - INFO - Split text into 1 sentences after cleanup
|
69 |
+
2024-12-02 20:46:08,074 - SentenceAnalyzer - DEBUG - Logger set up successfully
|
70 |
+
2024-12-02 20:46:08,075 - SentenceAnalyzer - INFO - SentenceAnalyzer initialized successfully
|
71 |
+
2024-12-02 20:47:48,873 - SentenceAnalyzer - DEBUG - Starting sentence splitting
|
72 |
+
2024-12-02 20:47:48,874 - SentenceAnalyzer - DEBUG - Normalized text using NFC
|
73 |
+
2024-12-02 20:47:48,874 - SentenceAnalyzer - DEBUG - Removed page numbers and chapter titles
|
74 |
+
2024-12-02 20:47:48,875 - SentenceAnalyzer - DEBUG - Replaced hyphenated line breaks
|
75 |
+
2024-12-02 20:47:48,875 - SentenceAnalyzer - DEBUG - Replaced multiple newlines with a space
|
76 |
+
2024-12-02 20:47:48,875 - SentenceAnalyzer - DEBUG - Normalized whitespace
|
77 |
+
2024-12-02 20:47:48,898 - SentenceAnalyzer - DEBUG - Split text into 1 sentences using NLTK
|
78 |
+
2024-12-02 20:47:48,898 - SentenceAnalyzer - INFO - Split text into 1 sentences after cleanup
|