Spaces:
Running
Running
Bring the Space up to the pyharp example standard (taxonomy tags, __main__ guard, show_error, v0.4.0)
Browse files- README.md +1 -1
- app.py +29 -28
- requirements.txt +2 -1
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: 🔇
|
|
| 4 |
colorFrom: green
|
| 5 |
colorTo: indigo
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
python_version: '3.10'
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
|
|
|
| 4 |
colorFrom: green
|
| 5 |
colorTo: indigo
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 6.24.0
|
| 8 |
python_version: '3.10'
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
app.py
CHANGED
|
@@ -8,7 +8,7 @@ import soundfile as sf
|
|
| 8 |
import librosa
|
| 9 |
import torch
|
| 10 |
|
| 11 |
-
from pyharp import ModelCard, build_endpoint
|
| 12 |
from df import enhance, init_df
|
| 13 |
|
| 14 |
# -----------------------------
|
|
@@ -21,7 +21,7 @@ model_card = ModelCard(
|
|
| 21 |
"Input is converted to mono 48kHz. Slider controls strength through wet/dry blend."
|
| 22 |
),
|
| 23 |
author="Derek Llanes",
|
| 24 |
-
tags=[
|
| 25 |
)
|
| 26 |
|
| 27 |
# -----------------------------
|
|
@@ -107,29 +107,30 @@ def process_fn(input_audio_path: str, noise_atten_db: float) -> str:
|
|
| 107 |
# -----------------------------
|
| 108 |
# Gradio endpoint
|
| 109 |
# -----------------------------
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
|
|
|
|
|
| 8 |
import librosa
|
| 9 |
import torch
|
| 10 |
|
| 11 |
+
from pyharp import ModelCard, build_endpoint, Subcategory
|
| 12 |
from df import enhance, init_df
|
| 13 |
|
| 14 |
# -----------------------------
|
|
|
|
| 21 |
"Input is converted to mono 48kHz. Slider controls strength through wet/dry blend."
|
| 22 |
),
|
| 23 |
author="Derek Llanes",
|
| 24 |
+
tags=[Subcategory.DENOISING, 'denoise', 'speech enhancement', 'deepfilternet', 'v3'],
|
| 25 |
)
|
| 26 |
|
| 27 |
# -----------------------------
|
|
|
|
| 107 |
# -----------------------------
|
| 108 |
# Gradio endpoint
|
| 109 |
# -----------------------------
|
| 110 |
+
if __name__ == "__main__":
|
| 111 |
+
with gr.Blocks() as demo:
|
| 112 |
+
input_components = [
|
| 113 |
+
gr.Audio(type="filepath", label="Input Audio").harp_required(True),
|
| 114 |
+
gr.Slider(
|
| 115 |
+
minimum=0,
|
| 116 |
+
maximum=30,
|
| 117 |
+
step=1,
|
| 118 |
+
value=12,
|
| 119 |
+
label="Noise Attenuation (dB)",
|
| 120 |
+
info="0 = no change, 30 = strongest. Implemented as wet/dry strength.",
|
| 121 |
+
),
|
| 122 |
+
]
|
| 123 |
+
|
| 124 |
+
output_components = [
|
| 125 |
+
gr.Audio(type="filepath", label="Output Audio")
|
| 126 |
+
.set_info("Denoised audio output."),
|
| 127 |
+
]
|
| 128 |
+
|
| 129 |
+
app = build_endpoint(
|
| 130 |
+
model_card=model_card,
|
| 131 |
+
input_components=input_components,
|
| 132 |
+
output_components=output_components,
|
| 133 |
+
process_fn=process_fn,
|
| 134 |
+
)
|
| 135 |
+
|
| 136 |
+
demo.queue().launch(share=True, show_error=True, pwa=True)
|
requirements.txt
CHANGED
|
@@ -4,4 +4,5 @@ torchaudio==2.2.2
|
|
| 4 |
numpy==1.26.4
|
| 5 |
soundfile==0.13.1
|
| 6 |
librosa==0.11.0
|
| 7 |
-
git+https://github.com/TEAMuP-dev/pyharp.git@v0.
|
|
|
|
|
|
| 4 |
numpy==1.26.4
|
| 5 |
soundfile==0.13.1
|
| 6 |
librosa==0.11.0
|
| 7 |
+
git+https://github.com/TEAMuP-dev/pyharp.git@v0.4.0
|
| 8 |
+
spaces>=0.51.1
|