Spaces:
Running
Running
Devin Xie
commited on
Commit
·
4ebf4f4
1
Parent(s):
350cb58
minor changes
Browse files
app.py
CHANGED
@@ -11,19 +11,25 @@ model = "tts_models/multilingual/multi-dataset/xtts_v2"
|
|
11 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
12 |
tts = TTS(model).to(device)
|
13 |
|
14 |
-
|
15 |
-
|
|
|
|
|
16 |
|
17 |
-
#
|
18 |
-
|
19 |
-
st.
|
20 |
|
21 |
-
#
|
22 |
-
|
|
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
27 |
|
28 |
st.audio(output_audio, format='audio/wav')
|
29 |
|
|
|
11 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
12 |
tts = TTS(model).to(device)
|
13 |
|
14 |
+
def main():
|
15 |
+
# Title
|
16 |
+
title = f"""<h1 align="center" style="font-size: 2rem";>Voice Clone</h1>"""
|
17 |
+
st.markdown(title, unsafe_allow_html=True)
|
18 |
|
19 |
+
# Subtitle
|
20 |
+
title = f"""<h2 align="center" style="font-size: 1.5rem";>Make your favorite characters say anything!</h2>"""
|
21 |
+
st.markdown(title, unsafe_allow_html=True)
|
22 |
|
23 |
+
# Upload audio file
|
24 |
+
uploaded_file = st.file_uploader('Add an audio file of the voice you want to clone...', type=['wav'])
|
25 |
+
st.audio(uploaded_file, format='audio/wav')
|
26 |
|
27 |
+
# Input text
|
28 |
+
text_input = st.text_input('Enter the text to synthesize')
|
29 |
+
|
30 |
+
if st.button('Synthesize') and uploaded_file is not None and text_input is not "":
|
31 |
+
with st.spinner('Synthesizing...'):
|
32 |
+
output_audio = tts.tts_to_file(text=text_input, speaker_wav=uploaded_file, language='en')
|
33 |
|
34 |
st.audio(output_audio, format='audio/wav')
|
35 |
|