sbv2 / app.py
tuna2134
initial
70c7d97
raw
history blame
629 Bytes
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()