|
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): |
|
wav_data = model.synthesize(text, "amitaro", 0, 0, 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(server_name="0.0.0.0") |