Spaces:
Running
Running
Devin Xie
commited on
Commit
·
cba51d2
1
Parent(s):
1f2644a
changed formatting, and added try except blocks
Browse files
app.py
CHANGED
@@ -32,17 +32,17 @@ def main():
|
|
32 |
uploaded_file = st.file_uploader('Add an audio file of the voice you want to clone...', type=['wav'])
|
33 |
|
34 |
if uploaded_file is not None:
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
st.audio(uploaded_file, format='audio/wav')
|
40 |
|
41 |
-
|
42 |
-
|
43 |
|
|
|
44 |
if text_input:
|
45 |
-
|
46 |
with st.spinner('Synthesizing...'):
|
47 |
output_path = generate_audio(uploaded_file, text_input)
|
48 |
|
@@ -50,10 +50,10 @@ def main():
|
|
50 |
with synthesized_audio:
|
51 |
st.header('Synthesized Audio')
|
52 |
st.audio(output_path, format='audio/wav')
|
|
|
|
|
53 |
else:
|
54 |
st.error('Please provide a text input!')
|
55 |
-
except:
|
56 |
-
st.error('There was a problem synthesizing the text, please check the input and try again. Remember, do not include punctuation in the input.')
|
57 |
|
58 |
if __name__ == '__main__':
|
59 |
main()
|
|
|
32 |
uploaded_file = st.file_uploader('Add an audio file of the voice you want to clone...', type=['wav'])
|
33 |
|
34 |
if uploaded_file is not None:
|
35 |
+
reference_audio = st.columns(1)
|
36 |
+
with reference_audio:
|
37 |
+
st.header('Reference Audio')
|
38 |
+
st.audio(uploaded_file, format='audio/wav')
|
|
|
39 |
|
40 |
+
# Input text
|
41 |
+
text_input = st.text_input('What do you want your character to say? (Alphabet letters only, DO NOT INCLUDE PUNCTUATION)')
|
42 |
|
43 |
+
if st.button('Synthesize'):
|
44 |
if text_input:
|
45 |
+
try:
|
46 |
with st.spinner('Synthesizing...'):
|
47 |
output_path = generate_audio(uploaded_file, text_input)
|
48 |
|
|
|
50 |
with synthesized_audio:
|
51 |
st.header('Synthesized Audio')
|
52 |
st.audio(output_path, format='audio/wav')
|
53 |
+
except:
|
54 |
+
st.error('There was an issue synthesizing the text. Please check the input and try again. Remember, do not include punctuation.')
|
55 |
else:
|
56 |
st.error('Please provide a text input!')
|
|
|
|
|
57 |
|
58 |
if __name__ == '__main__':
|
59 |
main()
|