Spaces:
Running
Running
Devin Xie commited on
Commit ·
1f2644a
1
Parent(s): ba596b5
changed formatting, and added try except blocks
Browse files
app.py
CHANGED
|
@@ -31,24 +31,29 @@ def main():
|
|
| 31 |
# Upload audio file
|
| 32 |
uploaded_file = st.file_uploader('Add an audio file of the voice you want to clone...', type=['wav'])
|
| 33 |
|
| 34 |
-
# Input text
|
| 35 |
-
text_input = st.text_input('Enter the text to synthesize')
|
| 36 |
-
|
| 37 |
if uploaded_file is not None:
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
st.
|
| 50 |
-
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
if __name__ == '__main__':
|
| 54 |
main()
|
|
|
|
| 31 |
# Upload audio file
|
| 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 |
+
try:
|
| 36 |
+
reference_audio = st.columns(1)
|
| 37 |
+
with reference_audio:
|
| 38 |
+
st.header('Reference Audio')
|
| 39 |
+
st.audio(uploaded_file, format='audio/wav')
|
| 40 |
+
|
| 41 |
+
# Input text
|
| 42 |
+
text_input = st.text_input('What do you want your character to say? (Alphabet letters only, DO NOT INCLUDE PUNCTUATION)')
|
| 43 |
+
|
| 44 |
+
if text_input:
|
| 45 |
+
if st.button('Synthesize'):
|
| 46 |
+
with st.spinner('Synthesizing...'):
|
| 47 |
+
output_path = generate_audio(uploaded_file, text_input)
|
| 48 |
+
|
| 49 |
+
synthesized_audio = st.columns(1)
|
| 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()
|