Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ import soundfile as sf
|
|
4 |
import uuid
|
5 |
import datetime
|
6 |
import shutil
|
7 |
-
from transformers import
|
8 |
import scipy.io.wavfile
|
9 |
import numpy as np
|
10 |
|
@@ -71,13 +71,9 @@ def tts_tibetan(input_text):
|
|
71 |
# Perform TTS inference for each sentence
|
72 |
speech = synthesiser(sentence)
|
73 |
|
74 |
-
# Extract the audio data and sampling rate from the pipeline output
|
75 |
-
audio_data = np.array(speech["audio"])
|
76 |
-
sample_rate = speech["sampling_rate"]
|
77 |
-
|
78 |
# Save each sentence as a separate WAV file
|
79 |
wav_path = f"{user_dir}/s_{str(i).zfill(10)}.wav"
|
80 |
-
scipy.io.wavfile.write(wav_path, rate=
|
81 |
|
82 |
# Combine the generated audio into one file
|
83 |
combined_file_path = combine_wav(user_dir, timestamp)
|
|
|
4 |
import uuid
|
5 |
import datetime
|
6 |
import shutil
|
7 |
+
from transformers import pipeline
|
8 |
import scipy.io.wavfile
|
9 |
import numpy as np
|
10 |
|
|
|
71 |
# Perform TTS inference for each sentence
|
72 |
speech = synthesiser(sentence)
|
73 |
|
|
|
|
|
|
|
|
|
74 |
# Save each sentence as a separate WAV file
|
75 |
wav_path = f"{user_dir}/s_{str(i).zfill(10)}.wav"
|
76 |
+
scipy.io.wavfile.write(wav_path, rate=speech["sampling_rate"], data=speech["audio"][0])
|
77 |
|
78 |
# Combine the generated audio into one file
|
79 |
combined_file_path = combine_wav(user_dir, timestamp)
|