Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -39,9 +39,13 @@ def parse_multilingual_text(input_text):
|
|
39 |
|
40 |
@spaces.GPU
|
41 |
def generate_segment_audio(text, lang, speaker_url, pipe):
|
|
|
42 |
if not isinstance(text, str):
|
|
|
|
|
|
|
43 |
text = text.decode("utf-8") if isinstance(text, bytes) else str(text)
|
44 |
-
audio_data = pipe.generate(text,
|
45 |
resample_audio = resampler(newsr=24000)
|
46 |
audio_data_resampled = next(resample_audio([{'sample_rate': 24000, 'samples': audio_data.cpu()}]))['samples_24k']
|
47 |
audio_np = audio_data_resampled.cpu().numpy()
|
|
|
39 |
|
40 |
@spaces.GPU
|
41 |
def generate_segment_audio(text, lang, speaker_url, pipe):
|
42 |
+
|
43 |
if not isinstance(text, str):
|
44 |
+
print("Speaker Audio Type:", type(speaker_audio))
|
45 |
+
with open(speaker_audio, 'rb') as file:
|
46 |
+
speaker_audio = file.read()
|
47 |
text = text.decode("utf-8") if isinstance(text, bytes) else str(text)
|
48 |
+
audio_data = pipe.generate(text, speaker_audio, lang)
|
49 |
resample_audio = resampler(newsr=24000)
|
50 |
audio_data_resampled = next(resample_audio([{'sample_rate': 24000, 'samples': audio_data.cpu()}]))['samples_24k']
|
51 |
audio_np = audio_data_resampled.cpu().numpy()
|