SpyroSigma commited on
Commit
72b08c4
·
verified ·
1 Parent(s): 46331e4

Created app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import spaces
2
+ import gradio as gr
3
+ import torch
4
+ from TTS.api import TTS
5
+ import os
6
+ os.environ["COQUI_TOS_AGREED"] = "1"
7
+
8
+ device = "cuda"
9
+
10
+ tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
11
+
12
+ @spaces.GPU(enable_queue=True)
13
+ def clone(text):
14
+ audio = 'https://github.com/Spyrosigma/Voices-in-my-Head/blob/main/voice1.mp3'
15
+ tts.tts_to_file(text=text, speaker_wav=audio, language="en", file_path="./output.wav")
16
+ return "./output.wav"
17
+
18
+ iface = gr.Interface(fn=clone,
19
+ inputs=[gr.Textbox(label='Text'),gr.Audio(type='filepath', label='Voice reference audio file')],
20
+ outputs=gr.Audio(type='filepath'),
21
+ title='Voice Clone',
22
+ description="""
23
+ ❤️
24
+ """,
25
+ theme = gr.themes.Base(primary_hue="teal",secondary_hue="teal",neutral_hue="slate"),
26
+ iface.launch()