Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -192,10 +192,9 @@ def apply_noisereduce(audio_list):
|
|
192 |
# Convert audio to numpy array
|
193 |
samples = np.array(audio.get_array_of_samples())
|
194 |
|
195 |
-
# Reduce noise
|
196 |
reduced_noise = nr.reduce_noise(y=samples, sr=audio.frame_rate, prop_decrease=0.6)
|
197 |
|
198 |
-
|
199 |
reduced_audio = AudioSegment(
|
200 |
reduced_noise.tobytes(),
|
201 |
frame_rate=audio.frame_rate,
|
@@ -203,7 +202,7 @@ def apply_noisereduce(audio_list):
|
|
203 |
channels=audio.channels
|
204 |
)
|
205 |
|
206 |
-
|
207 |
reduced_audio.export(out_path, format="wav")
|
208 |
result.append(out_path)
|
209 |
|
@@ -233,7 +232,7 @@ def run(audio_files, file_m, file_index):
|
|
233 |
|
234 |
random_tag = "USER_" + str(random.randint(10000000, 99999999))
|
235 |
|
236 |
-
|
237 |
pitch_alg = "rmvpe+"
|
238 |
pitch_lvl = 0
|
239 |
index_inf = 0.75
|
@@ -257,11 +256,10 @@ def run(audio_files, file_m, file_index):
|
|
257 |
|
258 |
result = convert_now(audio_files, random_tag, converter)
|
259 |
|
260 |
-
#
|
261 |
-
|
262 |
|
263 |
return result
|
264 |
-
|
265 |
def model_conf():
|
266 |
model_files = [f for f in os.listdir("models") if f.endswith(".pth")]
|
267 |
return gr.Dropdown(
|
|
|
192 |
# Convert audio to numpy array
|
193 |
samples = np.array(audio.get_array_of_samples())
|
194 |
|
|
|
195 |
reduced_noise = nr.reduce_noise(y=samples, sr=audio.frame_rate, prop_decrease=0.6)
|
196 |
|
197 |
+
|
198 |
reduced_audio = AudioSegment(
|
199 |
reduced_noise.tobytes(),
|
200 |
frame_rate=audio.frame_rate,
|
|
|
202 |
channels=audio.channels
|
203 |
)
|
204 |
|
205 |
+
|
206 |
reduced_audio.export(out_path, format="wav")
|
207 |
result.append(out_path)
|
208 |
|
|
|
232 |
|
233 |
random_tag = "USER_" + str(random.randint(10000000, 99999999))
|
234 |
|
235 |
+
|
236 |
pitch_alg = "rmvpe+"
|
237 |
pitch_lvl = 0
|
238 |
index_inf = 0.75
|
|
|
256 |
|
257 |
result = convert_now(audio_files, random_tag, converter)
|
258 |
|
259 |
+
# Always apply noise reduction
|
260 |
+
result = apply_noisereduce(result)
|
261 |
|
262 |
return result
|
|
|
263 |
def model_conf():
|
264 |
model_files = [f for f in os.listdir("models") if f.endswith(".pth")]
|
265 |
return gr.Dropdown(
|