Spaces:
Running
on
Zero
Running
on
Zero
Aboubacar OUATTARA - kaira
commited on
Commit
•
0249b26
1
Parent(s):
ace3461
add audios files
Browse files
app.py
CHANGED
@@ -30,7 +30,7 @@ tts = BambaraTTS(tts_model)
|
|
30 |
@spaces.GPU
|
31 |
def translate_to_bambara(text, src_lang):
|
32 |
translation = translator(text, src_lang=src_lang, tgt_lang="bam_Latn")
|
33 |
-
return translation[0]['translation_text']
|
34 |
|
35 |
|
36 |
# Function to convert text to speech
|
@@ -133,46 +133,21 @@ def _fn(
|
|
133 |
bambara_text = translate_to_bambara(text, source_lang)
|
134 |
|
135 |
# Step 2: Convert the translated text to speech with reference audio
|
136 |
-
if reference_audio is not None:
|
137 |
-
|
138 |
-
else:
|
139 |
-
|
140 |
-
|
141 |
-
# Step 3: Enhance the audio
|
142 |
-
denoised_audio, enhanced_audio = enhance_speech(
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
)
|
150 |
|
151 |
-
print("Audio Array Shape:", audio_array.shape)
|
152 |
-
print("Sample Rate:", sampling_rate)
|
153 |
-
print("Audio Array Dtype:", audio_array.dtype)
|
154 |
-
print("Max Value in Audio Array:", torch.max(audio_array))
|
155 |
-
print("Min Value in Audio Array:", torch.min(audio_array))
|
156 |
-
print("Sampling rate type: ", type(sampling_rate))
|
157 |
-
print("Denoised sampling rate type: ", type(denoised_audio[0]))
|
158 |
-
print("Enhanced sampling rate type: ", type(enhanced_audio[0]))
|
159 |
-
import resource
|
160 |
-
|
161 |
-
# Get the soft and hard limits for the number of open file descriptors
|
162 |
-
soft_limit, hard_limit = resource.getrlimit(resource.RLIMIT_NOFILE)
|
163 |
-
print('Soft limit for RLIMIT_NOFILE:', soft_limit)
|
164 |
-
print('Hard limit for RLIMIT_NOFILE:', hard_limit)
|
165 |
-
|
166 |
-
print('Is CUDA available:', torch.cuda.is_available())
|
167 |
-
print('CUDA version:', torch.version.cuda)
|
168 |
-
print('CuDNN version:', torch.backends.cudnn.version())
|
169 |
-
|
170 |
-
def check_tensor(tensor):
|
171 |
-
print('Contains NaN:', torch.isnan(tensor).any())
|
172 |
-
print('Contains Inf:', torch.isinf(tensor).any())
|
173 |
-
|
174 |
-
# Use this function to check your audio tensor
|
175 |
-
check_tensor(audio_array)
|
176 |
# Return all outputs
|
177 |
return (
|
178 |
bambara_text,
|
|
|
30 |
@spaces.GPU
|
31 |
def translate_to_bambara(text, src_lang):
|
32 |
translation = translator(text, src_lang=src_lang, tgt_lang="bam_Latn")
|
33 |
+
return str(translation[0]['translation_text'])
|
34 |
|
35 |
|
36 |
# Function to convert text to speech
|
|
|
133 |
bambara_text = translate_to_bambara(text, source_lang)
|
134 |
|
135 |
# Step 2: Convert the translated text to speech with reference audio
|
136 |
+
# if reference_audio is not None:
|
137 |
+
# audio_array, sampling_rate = text_to_speech(bambara_text, reference_audio)
|
138 |
+
# else:
|
139 |
+
# audio_array, sampling_rate = text_to_speech(bambara_text)
|
140 |
+
#
|
141 |
+
# # Step 3: Enhance the audio
|
142 |
+
# denoised_audio, enhanced_audio = enhance_speech(
|
143 |
+
# audio_array,
|
144 |
+
# sampling_rate,
|
145 |
+
# solver,
|
146 |
+
# nfe,
|
147 |
+
# prior_temp,
|
148 |
+
# denoise_before_enhancement
|
149 |
+
# )
|
150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
# Return all outputs
|
152 |
return (
|
153 |
bambara_text,
|