Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ from vietTTS import nat_normalize_text
|
|
| 4 |
import numpy as np
|
| 5 |
import gradio as gr
|
| 6 |
import os
|
|
|
|
| 7 |
|
| 8 |
|
| 9 |
def text_to_speech(text):
|
|
@@ -23,9 +24,12 @@ def text_to_speech(text):
|
|
| 23 |
|
| 24 |
|
| 25 |
def speak(text):
|
|
|
|
| 26 |
y = text_to_speech(text)
|
|
|
|
| 27 |
return 16_000, y
|
| 28 |
|
|
|
|
| 29 |
title = "vietTTS"
|
| 30 |
description = "A vietnamese text-to-speech demo."
|
| 31 |
duration_slider = gr.Slider(minimum=0.1, maximum=5, value=1, step=0.1, label='速度 Speed')
|
|
|
|
| 4 |
import numpy as np
|
| 5 |
import gradio as gr
|
| 6 |
import os
|
| 7 |
+
import librosa
|
| 8 |
|
| 9 |
|
| 10 |
def text_to_speech(text):
|
|
|
|
| 24 |
|
| 25 |
|
| 26 |
def speak(text):
|
| 27 |
+
speed = duration_slider.value
|
| 28 |
y = text_to_speech(text)
|
| 29 |
+
y = librosa.effects.time_stretch(y, speed)
|
| 30 |
return 16_000, y
|
| 31 |
|
| 32 |
+
|
| 33 |
title = "vietTTS"
|
| 34 |
description = "A vietnamese text-to-speech demo."
|
| 35 |
duration_slider = gr.Slider(minimum=0.1, maximum=5, value=1, step=0.1, label='速度 Speed')
|