File size: 629 Bytes
70c7d97 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import gradio as gr
from sbv2_bindings import TTSModel
from scipy.io import wavfile
import io
model = TTSModel.from_path("models/deberta.onnx", "models/tokenizer.json")
model.load_sbv2file_from_path("amitaro", "models/amitaro.sbv2")
def generate(text):
style_vector = model.get_style_vector("amitaro", 0, 1.0)
wav_data = model.synthesize(text, "amitaro", style_vector, 0.0, 0.5)
byte_io = io.BytesIO(wav_data)
sr, data = wavfile.read(byte_io)
return sr, data
gradio_app = gr.Interface(
fn=generate,
inputs=["text"],
outputs=[gr.Audio()],
)
if __name__ == "__main__":
gradio_app.launch() |