Tonic commited on
Commit
c2b9474
1 Parent(s): 68c37fe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -37,14 +37,15 @@ def parse_multilingual_text(input_text):
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
- stoks = pipe.t2s.generate([text], lang=[lang])
41
- audio_data = pipe.generate(stoks, speaker_url, lang)
 
 
42
  resample_audio = resampler(newsr=24000)
43
  audio_data_resampled = next(resample_audio([{'sample_rate': 24000, 'samples': audio_data.cpu()}]))['samples_24k']
44
  audio_np = audio_data_resampled.cpu().numpy()
45
  return audio_np
46
 
47
-
48
  # Function to concatenate audio segments
49
  def concatenate_audio_segments(segments):
50
  concatenated_audio = np.concatenate(segments, axis=0)
 
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
+ # Generating stoks (tokens<pl>) from text
42
+ # stoks = pipe.t2s.generate([text], lang=[lang])
43
+ audio_data = pipe.generate(text, speaker_url, lang)
44
  resample_audio = resampler(newsr=24000)
45
  audio_data_resampled = next(resample_audio([{'sample_rate': 24000, 'samples': audio_data.cpu()}]))['samples_24k']
46
  audio_np = audio_data_resampled.cpu().numpy()
47
  return audio_np
48
 
 
49
  # Function to concatenate audio segments
50
  def concatenate_audio_segments(segments):
51
  concatenated_audio = np.concatenate(segments, axis=0)