OwnVoiceModelsourav commited on
Commit
b703940
·
verified ·
1 Parent(s): 6a8a4bc

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # OpenVoiceV2 model load
5
+ tts = pipeline("text-to-speech", model="myshell-ai/OpenVoiceV2")
6
+
7
+ def generate_voice(text):
8
+ audio = tts(text)
9
+ return (22050, audio["audio"])
10
+
11
+ demo = gr.Interface(
12
+ fn=generate_voice,
13
+ inputs=gr.Textbox(label="Type your text"),
14
+ outputs=gr.Audio(label="Generated Voice"),
15
+ title="🔊 OpenVoiceV2 - Text to Speech"
16
+ )
17
+
18
+ demo.launch()