Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ import re
|
|
3 |
import time
|
4 |
import sys
|
5 |
import subprocess
|
|
|
6 |
import gradio as gr
|
7 |
from TTS.api import TTS
|
8 |
from TTS.tts.configs.xtts_config import XttsConfig
|
@@ -72,19 +73,14 @@ def predict(prompt, language, reference_audio):
|
|
72 |
top_p=top_p
|
73 |
)
|
74 |
|
75 |
-
audio_segment = AudioSegment(
|
76 |
-
out["wav"].tobytes(),
|
77 |
-
frame_rate=config.audio["output_sample_rate"],
|
78 |
-
sample_width=2,
|
79 |
-
channels=1
|
80 |
-
)
|
81 |
-
|
82 |
inference_time = time.time() - start_time
|
83 |
|
84 |
output_path = "output.wav"
|
85 |
-
|
|
|
|
|
86 |
|
87 |
-
audio_length = len(
|
88 |
real_time_factor = inference_time / audio_length
|
89 |
|
90 |
metrics_text = f"Tiempo de generación: {inference_time:.2f} segundos\n"
|
|
|
3 |
import time
|
4 |
import sys
|
5 |
import subprocess
|
6 |
+
import scipy.io.wavfile as wavfile
|
7 |
import gradio as gr
|
8 |
from TTS.api import TTS
|
9 |
from TTS.tts.configs.xtts_config import XttsConfig
|
|
|
73 |
top_p=top_p
|
74 |
)
|
75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
inference_time = time.time() - start_time
|
77 |
|
78 |
output_path = "output.wav"
|
79 |
+
# Guardar el audio directamente desde el output del modelo
|
80 |
+
import scipy.io.wavfile as wavfile
|
81 |
+
wavfile.write(output_path, config.audio["output_sample_rate"], out["wav"])
|
82 |
|
83 |
+
audio_length = len(out["wav"]) / config.audio["output_sample_rate"] # duración del audio en segundos
|
84 |
real_time_factor = inference_time / audio_length
|
85 |
|
86 |
metrics_text = f"Tiempo de generación: {inference_time:.2f} segundos\n"
|