Amamrnaf commited on
Commit
b94855f
·
1 Parent(s): 5be0054
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import gradio as gr
2
  import os
3
  from coqui_tts import run_audio_generation_v1
 
4
 
5
  def process_audio(input_text, speaker_audio, speaker_name, option_selected):
6
  try:
@@ -10,7 +11,10 @@ def process_audio(input_text, speaker_audio, speaker_name, option_selected):
10
 
11
  # Copy speaker audio to the required location
12
  speaker_audio_path = "./tmp/audio/input_src/0.wav"
13
- os.rename(speaker_audio, speaker_audio_path)
 
 
 
14
 
15
  # Check selected option and execute corresponding function
16
  if option_selected == "Xtts_v2":
 
1
  import gradio as gr
2
  import os
3
  from coqui_tts import run_audio_generation_v1
4
+ import shutil
5
 
6
  def process_audio(input_text, speaker_audio, speaker_name, option_selected):
7
  try:
 
11
 
12
  # Copy speaker audio to the required location
13
  speaker_audio_path = "./tmp/audio/input_src/0.wav"
14
+ if os.path.exists(speaker_audio):
15
+ shutil.copy(speaker_audio, speaker_audio_path)
16
+ else:
17
+ raise FileNotFoundError(f"Speaker audio file not found: {speaker_audio}")
18
 
19
  # Check selected option and execute corresponding function
20
  if option_selected == "Xtts_v2":