antoniomae commited on
Commit
564181f
1 Parent(s): b92267f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -35,8 +35,8 @@ st.title(APP_NAME)
35
  st.image(APP_LOGO, use_column_width=True)
36
  st.markdown(APP_DESCRIPTION)
37
 
38
- input_wav = st.file_uploader("Upload a WAV file with your voice", type=["wav"])
39
- clone_wav = st.file_uploader("Upload a WAV file with voice to clone", type=["wav"])
40
 
41
  if input_wav and clone_wav:
42
  progress_bar = st.progress(0)
@@ -44,18 +44,18 @@ if input_wav and clone_wav:
44
 
45
  current_datetime = datetime.datetime.now()
46
  formatted_datetime = current_datetime.strftime("%Y-%m-%d_%H%M%S")
47
- output_filename = f"recording_{formatted_datetime}.wav"
48
 
49
- temp_input_file = create_temp_file(input_wav)
50
- temp_clone_file = create_temp_file(clone_wav)
51
 
52
  update_progress(0, 'Loading TTS model...')
53
  api = TTS("voice_conversion_models/multilingual/vctk/freevc24")
54
 
55
- update_progress(50, 'Generating audio...')
56
  api.voice_conversion_to_file(
57
- source_wav=temp_input_file.name,
58
- target_wav=temp_clone_file.name,
59
  file_path=output_filename
60
  )
61
 
@@ -67,6 +67,6 @@ if input_wav and clone_wav:
67
 
68
  update_progress(100, 'Audio generated successfully!')
69
 
70
- st.audio(audio_bytes, format='audio/wav')
71
 
72
- st.download_button('Download WAV', data=audio_bytes, file_name='output.wav')
 
35
  st.image(APP_LOGO, use_column_width=True)
36
  st.markdown(APP_DESCRIPTION)
37
 
38
+ input_wav = st.file_uploader("Upload a WAV file with your voice", type=["mp3"])
39
+ clone_wav = st.file_uploader("Upload a WAV file with voice to clone", type=["mp3"])
40
 
41
  if input_wav and clone_wav:
42
  progress_bar = st.progress(0)
 
44
 
45
  current_datetime = datetime.datetime.now()
46
  formatted_datetime = current_datetime.strftime("%Y-%m-%d_%H%M%S")
47
+ output_filename = f"recording_{formatted_datetime}.mp3"
48
 
49
+ temp_input_file = create_temp_file(input_mp3)
50
+ temp_clone_file = create_temp_file(clone_mp3)
51
 
52
  update_progress(0, 'Loading TTS model...')
53
  api = TTS("voice_conversion_models/multilingual/vctk/freevc24")
54
 
55
+ update_progress(50, 'Generating mp3...')
56
  api.voice_conversion_to_file(
57
+ source_mp3=temp_input_file.name,
58
+ target_mp3=temp_clone_file.name,
59
  file_path=output_filename
60
  )
61
 
 
67
 
68
  update_progress(100, 'Audio generated successfully!')
69
 
70
+ st.audio(audio_bytes, format='audio/mp3')
71
 
72
+ st.download_button('Download mp3', data=audio_bytes, file_name='output.mp3')