File size: 851 Bytes
5165e58 |
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 27 28 |
import gradio as gr
from openvoice import OpenVoice
# Load OpenVoice model (adjust to your setup)
model = OpenVoice(language="en")
def clone_and_speak(audio, text):
output_path = "output.wav"
model.clone_voice(
source_audio_path=audio.name,
target_text=text,
output_path=output_path
)
return output_path
with gr.Blocks() as demo:
gr.Markdown("# OpenVoice TTS - Hugging Face Space")
with gr.Row():
audio_input = gr.Audio(label="Upload voice to clone", type="file")
text_input = gr.Textbox(label="Enter text to synthesize")
with gr.Row():
generate_btn = gr.Button("Generate Audio")
audio_output = gr.Audio(label="Synthesized Output", type="filepath")
generate_btn.click(fn=clone_and_speak, inputs=[audio_input, text_input], outputs=audio_output)
demo.launch()
|