harp-dev commited on
Commit
b123446
Β·
verified Β·
1 Parent(s): b6cd9dc

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 +18 -16
  3. requirements.txt +2 -1
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: πŸ₯
4
  colorFrom: red
5
  colorTo: purple
6
  sdk: gradio
7
- sdk_version: 5.28.0
8
  app_file: app.py
9
  pinned: false
10
  license: cc-by-nc-4.0
 
4
  colorFrom: red
5
  colorTo: purple
6
  sdk: gradio
7
+ sdk_version: 6.24.0
8
  app_file: app.py
9
  pinned: false
10
  license: cc-by-nc-4.0
app.py CHANGED
@@ -14,6 +14,7 @@ from typing import Union, Tuple, Optional
14
  from torch import Tensor
15
 
16
  from pyharp import build_endpoint, ModelCard
 
17
 
18
 
19
  # ─────────────────────────────────────────────
@@ -286,7 +287,7 @@ model_card = ModelCard(
286
  name="LarsNet Drum Stem Separator",
287
  description="Separates a drum mix into individual drum stems: Kick, Snare, Toms, Hi-Hat, and Cymbals.",
288
  author="A. I. Mezza, et al.",
289
- tags=["drums", "demucs", "source-separation", "pyharp", "stems", "multi-output"],
290
  )
291
 
292
  MODEL = LarsNet(wiener_filter=False, device="cpu", config="config.yaml")
@@ -305,19 +306,20 @@ def process_fn(audio_path: str):
305
  return tuple(output_paths)
306
 
307
 
308
- with gr.Blocks() as demo:
309
- input_audio = gr.Audio(type="filepath", label="Drum Mix (Input)").harp_required(True)
310
- output_kick = gr.Audio(type="filepath", label="Kick")
311
- output_snare = gr.Audio(type="filepath", label="Snare")
312
- output_toms = gr.Audio(type="filepath", label="Toms")
313
- output_hihat = gr.Audio(type="filepath", label="Hi-Hat")
314
- output_cymbals = gr.Audio(type="filepath", label="Cymbals")
315
-
316
- app = build_endpoint(
317
- model_card=model_card,
318
- input_components=[input_audio],
319
- output_components=[output_kick, output_snare, output_toms, output_hihat, output_cymbals],
320
- process_fn=process_fn,
321
- )
 
322
 
323
- demo.queue().launch(show_error=True)
 
14
  from torch import Tensor
15
 
16
  from pyharp import build_endpoint, ModelCard
17
+ from pyharp.tags import Subcategory
18
 
19
 
20
  # ─────────────────────────────────────────────
 
287
  name="LarsNet Drum Stem Separator",
288
  description="Separates a drum mix into individual drum stems: Kick, Snare, Toms, Hi-Hat, and Cymbals.",
289
  author="A. I. Mezza, et al.",
290
+ tags=[Subcategory.STEM_SEPARATION, 'drums', 'demucs', 'source-separation', 'pyharp', 'stems', 'multi-output'],
291
  )
292
 
293
  MODEL = LarsNet(wiener_filter=False, device="cpu", config="config.yaml")
 
306
  return tuple(output_paths)
307
 
308
 
309
+ if __name__ == "__main__":
310
+ with gr.Blocks() as demo:
311
+ input_audio = gr.Audio(type="filepath", label="Drum Mix (Input)").harp_required(True)
312
+ output_kick = gr.Audio(type="filepath", label="Kick")
313
+ output_snare = gr.Audio(type="filepath", label="Snare")
314
+ output_toms = gr.Audio(type="filepath", label="Toms")
315
+ output_hihat = gr.Audio(type="filepath", label="Hi-Hat")
316
+ output_cymbals = gr.Audio(type="filepath", label="Cymbals")
317
+
318
+ app = build_endpoint(
319
+ model_card=model_card,
320
+ input_components=[input_audio],
321
+ output_components=[output_kick, output_snare, output_toms, output_hihat, output_cymbals],
322
+ process_fn=process_fn,
323
+ )
324
 
325
+ demo.queue().launch(pwa=True, share=True, show_error=True)
requirements.txt CHANGED
@@ -1,8 +1,9 @@
1
  # pip install -r requirements.txt
2
- git+https://github.com/TEAMuP-dev/pyharp.git@v0.3.0
3
  torch==2.7
4
  torchaudio==2.7
5
  pyyaml
6
  tqdm
7
  soundfile
8
  torchcodec==0.7
 
 
1
  # pip install -r requirements.txt
2
+ git+https://github.com/TEAMuP-dev/pyharp.git@v0.4.0
3
  torch==2.7
4
  torchaudio==2.7
5
  pyyaml
6
  tqdm
7
  soundfile
8
  torchcodec==0.7
9
+ spaces>=0.51.1