File size: 431 Bytes
b703940
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr
from transformers import pipeline

# OpenVoiceV2 model load
tts = pipeline("text-to-speech", model="myshell-ai/OpenVoiceV2")

def generate_voice(text):
    audio = tts(text)
    return (22050, audio["audio"])

demo = gr.Interface(
    fn=generate_voice,
    inputs=gr.Textbox(label="Type your text"),
    outputs=gr.Audio(label="Generated Voice"),
    title="🔊 OpenVoiceV2 - Text to Speech"
)

demo.launch()