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 +21 -20
- requirements.txt +2 -1
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: ✂️
|
|
| 4 |
colorFrom: pink
|
| 5 |
colorTo: red
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
python_version: '3.13'
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
|
|
|
| 4 |
colorFrom: pink
|
| 5 |
colorTo: red
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 6.24.0
|
| 8 |
python_version: '3.13'
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
app.py
CHANGED
|
@@ -11,7 +11,7 @@ import librosa
|
|
| 11 |
import torch
|
| 12 |
import soundfile as sf
|
| 13 |
from huggingface_hub import hf_hub_download
|
| 14 |
-
from pyharp import ModelCard, build_endpoint
|
| 15 |
|
| 16 |
from models.resunet import ResUNet30
|
| 17 |
from models.clap_encoder import CLAP_Encoder
|
|
@@ -69,7 +69,7 @@ model_card = ModelCard(
|
|
| 69 |
name="AudioSep",
|
| 70 |
description="Separate any sound from a mixture using a natural language text description.",
|
| 71 |
author="Xubo Liu, Qiuqiang Kong, Yan Zhao, Haohe Liu, Yi Yuan, Yuzhuo Liu, Rui Xia, Yuxuan Wang, Mark D. Plumbley, Wenwu Wang",
|
| 72 |
-
tags=[
|
| 73 |
)
|
| 74 |
|
| 75 |
|
|
@@ -108,22 +108,23 @@ def process_fn(audio_path: str, text_query: str):
|
|
| 108 |
return out_path
|
| 109 |
|
| 110 |
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
"Separated
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
|
|
|
| 128 |
|
| 129 |
-
demo.queue().launch()
|
|
|
|
| 11 |
import torch
|
| 12 |
import soundfile as sf
|
| 13 |
from huggingface_hub import hf_hub_download
|
| 14 |
+
from pyharp import ModelCard, build_endpoint, Subcategory
|
| 15 |
|
| 16 |
from models.resunet import ResUNet30
|
| 17 |
from models.clap_encoder import CLAP_Encoder
|
|
|
|
| 69 |
name="AudioSep",
|
| 70 |
description="Separate any sound from a mixture using a natural language text description.",
|
| 71 |
author="Xubo Liu, Qiuqiang Kong, Yan Zhao, Haohe Liu, Yi Yuan, Yuzhuo Liu, Rui Xia, Yuxuan Wang, Mark D. Plumbley, Wenwu Wang",
|
| 72 |
+
tags=[Subcategory.TARGET_SOURCE_EXTRACTION, 'audio separation', 'text-queried', 'source separation'],
|
| 73 |
)
|
| 74 |
|
| 75 |
|
|
|
|
| 108 |
return out_path
|
| 109 |
|
| 110 |
|
| 111 |
+
if __name__ == "__main__":
|
| 112 |
+
with gr.Blocks() as demo:
|
| 113 |
+
input_components = [
|
| 114 |
+
gr.Audio(type="filepath", label="Input Audio (Mixture)").harp_required(True),
|
| 115 |
+
gr.Textbox(label="Text Query", placeholder="e.g. a dog barking"),
|
| 116 |
+
]
|
| 117 |
+
output_components = [
|
| 118 |
+
gr.Audio(type="filepath", label="Separated Audio").set_info(
|
| 119 |
+
"Separated audio at 32 kHz matching the text description."
|
| 120 |
+
),
|
| 121 |
+
]
|
| 122 |
+
|
| 123 |
+
build_endpoint(
|
| 124 |
+
model_card=model_card,
|
| 125 |
+
input_components=input_components,
|
| 126 |
+
output_components=output_components,
|
| 127 |
+
process_fn=process_fn,
|
| 128 |
+
)
|
| 129 |
|
| 130 |
+
demo.queue().launch(pwa=True, show_error=True, share=True)
|
requirements.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
git+https://github.com/TEAMuP-dev/pyharp.git@v0.
|
| 2 |
torch==2.6.0
|
| 3 |
torchaudio==2.6.0
|
| 4 |
torchvision==0.21.0
|
|
@@ -9,3 +9,4 @@ ftfy
|
|
| 9 |
braceexpand
|
| 10 |
torchlibrosa
|
| 11 |
huggingface_hub
|
|
|
|
|
|
| 1 |
+
git+https://github.com/TEAMuP-dev/pyharp.git@v0.4.0
|
| 2 |
torch==2.6.0
|
| 3 |
torchaudio==2.6.0
|
| 4 |
torchvision==0.21.0
|
|
|
|
| 9 |
braceexpand
|
| 10 |
torchlibrosa
|
| 11 |
huggingface_hub
|
| 12 |
+
spaces>=0.51.1
|