Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,30 +1,26 @@
|
|
| 1 |
-
import glob
|
| 2 |
import os
|
|
|
|
| 3 |
import gradio as gr
|
| 4 |
-
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
os.makedirs(out_dir, exist_ok=True)
|
| 8 |
|
| 9 |
-
|
| 10 |
-
separator.load_model(model_filename="UVR-MDX-NET-Inst_HQ_3.onnx")
|
| 11 |
-
|
| 12 |
-
def ambil_vokal(audio_file):
|
| 13 |
if not audio_file:
|
| 14 |
return None
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
return matched[0] if matched else None
|
| 22 |
|
| 23 |
demo = gr.Interface(
|
| 24 |
-
fn=
|
| 25 |
-
inputs=gr.Audio(type="filepath", label="Upload Audio"),
|
| 26 |
-
outputs=gr.Audio(type="filepath", label="Hasil
|
| 27 |
-
title="
|
| 28 |
)
|
| 29 |
|
| 30 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
+
import tempfile
|
| 3 |
import gradio as gr
|
| 4 |
+
import soundfile as sf
|
| 5 |
+
from df.enhance import enhance, init_df, load_audio, save_audio
|
| 6 |
|
| 7 |
+
model, df_state, _ = init_df()
|
|
|
|
| 8 |
|
| 9 |
+
def hapus_noise(audio_file):
|
|
|
|
|
|
|
|
|
|
| 10 |
if not audio_file:
|
| 11 |
return None
|
| 12 |
+
audio, _ = load_audio(audio_file, sr=df_state.sr())
|
| 13 |
+
enhanced = enhance(model, df_state, audio)
|
| 14 |
+
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as tmp:
|
| 15 |
+
out_path = tmp.name
|
| 16 |
+
save_audio(out_path, enhanced, df_state.sr())
|
| 17 |
+
return out_path
|
|
|
|
| 18 |
|
| 19 |
demo = gr.Interface(
|
| 20 |
+
fn=hapus_noise,
|
| 21 |
+
inputs=gr.Audio(type="filepath", label="Upload Audio Ber-noise"),
|
| 22 |
+
outputs=gr.Audio(type="filepath", label="Hasil Bersih Noise"),
|
| 23 |
+
title="Noise Remover (DeepFilterNet)"
|
| 24 |
)
|
| 25 |
|
| 26 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|