Tonic commited on
Commit
bc5ae86
1 Parent(s): e8d0c6b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -35,6 +35,9 @@ def parse_multilingual_text(input_text):
35
 
36
  @spaces.GPU
37
  def generate_segment_audio(text, lang, speaker_url, pipe):
 
 
 
38
  stoks = pipe.t2s.generate([text], lang=[lang])
39
  audio_data = pipe.generate(stoks, speaker_url, lang)
40
  resample_audio = resampler(newsr=24000)
@@ -42,6 +45,7 @@ def generate_segment_audio(text, lang, speaker_url, pipe):
42
  audio_np = audio_data_resampled.cpu().numpy()
43
  return audio_np
44
 
 
45
  # Function to concatenate audio segments
46
  def concatenate_audio_segments(segments):
47
  concatenated_audio = np.concatenate(segments, axis=0)
 
35
 
36
  @spaces.GPU
37
  def generate_segment_audio(text, lang, speaker_url, pipe):
38
+ if not isinstance(text, str):
39
+ text = text.decode("utf-8") if isinstance(text, bytes) else str(text)
40
+
41
  stoks = pipe.t2s.generate([text], lang=[lang])
42
  audio_data = pipe.generate(stoks, speaker_url, lang)
43
  resample_audio = resampler(newsr=24000)
 
45
  audio_np = audio_data_resampled.cpu().numpy()
46
  return audio_np
47
 
48
+
49
  # Function to concatenate audio segments
50
  def concatenate_audio_segments(segments):
51
  concatenated_audio = np.concatenate(segments, axis=0)