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