Spaces:
Running
on
Zero
Running
on
Zero
import gradio as gr | |
import os | |
import torchaudio | |
from fireredtts.fireredtts import FireRedTTS | |
gpt_path = 'https://huggingface.co/fireredteam/FireRedTTS/resolve/main/fireredtts_gpt.pt' | |
speaker_path = 'https://huggingface.co/fireredteam/FireRedTTS/resolve/main/fireredtts_speaker.bin' | |
decoder_path = 'https://huggingface.co/fireredteam/FireRedTTS/resolve/main/fireredtts_token2wav.pt' | |
tts = FireRedTTS( | |
config_path="configs/config_24k.json", | |
pretrained_path='pretrained_models', | |
) | |
def tts_inference(text, prompt_wav='examples/prompt_1.wav', lang='zh'): | |
syn_audio = tts.synthesize( | |
prompt_wav=prompt_wav, | |
text=text, | |
lang=lang, | |
) | |
return syn_audio.detach().cpu() | |
iface = gr.Interface( | |
fn=tts_inference, | |
inputs=[ | |
gr.Textbox(label="θΎε ₯ζζ¬"), | |
# gr.Dropdown(["en-US-Wav2Vec2-Kendra", "en-US-Wav2Vec2-John"], label="ιζ©ε£°ι³"), | |
# gr.Slider(minimum=0.5, maximum=2.0, value=1.0, label="θ―ι") | |
], | |
outputs=gr.Audio(label="ηζηθ―ι³"), | |
title="TTS Demo", | |
description="Enter some text and listen to the generated speech." | |
) | |
if __name__ == "__main__": | |
iface.launch() |