harp-dev commited on
Commit
61388cf
·
verified ·
1 Parent(s): ae90aab

Bring the Space up to the pyharp example standard (taxonomy tags, __main__ guard, show_error, v0.4.0)

Browse files
Files changed (3) hide show
  1. README.md +1 -1
  2. app.py +29 -28
  3. requirements.txt +2 -1
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 🔇
4
  colorFrom: green
5
  colorTo: indigo
6
  sdk: gradio
7
- sdk_version: 5.28.0
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=["denoise", "speech enhancement", "deepfilternet", "v3"],
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
- with gr.Blocks() as demo:
111
- input_components = [
112
- gr.Audio(type="filepath", label="Input Audio").harp_required(True),
113
- gr.Slider(
114
- minimum=0,
115
- maximum=30,
116
- step=1,
117
- value=12,
118
- label="Noise Attenuation (dB)",
119
- info="0 = no change, 30 = strongest. Implemented as wet/dry strength.",
120
- ),
121
- ]
122
-
123
- output_components = [
124
- gr.Audio(type="filepath", label="Output Audio")
125
- .set_info("Denoised audio output."),
126
- ]
127
-
128
- app = build_endpoint(
129
- model_card=model_card,
130
- input_components=input_components,
131
- output_components=output_components,
132
- process_fn=process_fn,
133
- )
134
-
135
- demo.queue().launch(show_error=False, pwa=True)
 
 
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.3.0
 
 
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