Spaces:
Running on Zero
Running on Zero
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 +34 -34
- requirements.txt +2 -1
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: 🩹
|
|
| 4 |
colorFrom: purple
|
| 5 |
colorTo: pink
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
python_version: '3.11'
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
|
|
|
| 4 |
colorFrom: purple
|
| 5 |
colorTo: pink
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 6.24.0
|
| 8 |
python_version: '3.11'
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
app.py
CHANGED
|
@@ -26,7 +26,7 @@ import torch
|
|
| 26 |
import torchaudio
|
| 27 |
from huggingface_hub import hf_hub_download
|
| 28 |
from omegaconf import OmegaConf
|
| 29 |
-
from pyharp import ModelCard, build_endpoint
|
| 30 |
|
| 31 |
# cqt_nsgt_pytorch clips an int-dtype array against np.inf with out=, which
|
| 32 |
# numpy's ufunc casting rules reject on any numpy version. Compute without
|
|
@@ -258,40 +258,40 @@ model_card = ModelCard(
|
|
| 258 |
"is filled."
|
| 259 |
),
|
| 260 |
author="Eloi Moliner, Vesa Välimäki",
|
| 261 |
-
tags=[
|
| 262 |
)
|
| 263 |
|
| 264 |
|
| 265 |
-
with gr.Blocks() as demo:
|
| 266 |
-
input_components = [
|
| 267 |
-
gr.Audio(type="filepath", label="Input Audio").harp_required(True),
|
| 268 |
-
gr.Dropdown(
|
| 269 |
-
choices=list(CHECKPOINTS.keys()),
|
| 270 |
-
value="MAESTRO (solo piano)",
|
| 271 |
-
label="Model",
|
| 272 |
-
info="Which checkpoint to inpaint with.",
|
| 273 |
-
),
|
| 274 |
-
gr.Slider(minimum=0.05, maximum=3.0, step=0.05, value=1.5, label="Gap Length (s)",
|
| 275 |
-
info="Length of the gap to fill (default: 1.5s, per repo config)"),
|
| 276 |
-
gr.Number(value=-1, label="Gap Position (s)",
|
| 277 |
-
info="Where the gap starts, from the beginning of the processed segment. -1 = centered (default, per repo config)"),
|
| 278 |
-
gr.Slider(minimum=10, maximum=150, step=1, value=35, label="Processing Steps",
|
| 279 |
-
info="Diffusion sampling steps (default: T=35, per repo config)"),
|
| 280 |
-
gr.Slider(minimum=0.0, maximum=1.0, step=0.05, value=0.25, label="Reconstruction Guidance",
|
| 281 |
-
info="How strongly the output is pulled toward the surrounding audio (default: ξ=0.25, per repo config)"),
|
| 282 |
-
]
|
| 283 |
-
output_components = [
|
| 284 |
-
gr.Audio(type="filepath", label="Output Audio").set_info(
|
| 285 |
-
"The processed segment with the gap filled in."
|
| 286 |
-
),
|
| 287 |
-
]
|
| 288 |
-
|
| 289 |
-
build_endpoint(
|
| 290 |
-
model_card=model_card,
|
| 291 |
-
input_components=input_components,
|
| 292 |
-
output_components=output_components,
|
| 293 |
-
process_fn=process_fn,
|
| 294 |
-
)
|
| 295 |
-
|
| 296 |
if __name__ == "__main__":
|
| 297 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
import torchaudio
|
| 27 |
from huggingface_hub import hf_hub_download
|
| 28 |
from omegaconf import OmegaConf
|
| 29 |
+
from pyharp import ModelCard, build_endpoint, Subcategory
|
| 30 |
|
| 31 |
# cqt_nsgt_pytorch clips an int-dtype array against np.inf with out=, which
|
| 32 |
# numpy's ufunc casting rules reject on any numpy version. Compute without
|
|
|
|
| 258 |
"is filled."
|
| 259 |
),
|
| 260 |
author="Eloi Moliner, Vesa Välimäki",
|
| 261 |
+
tags=[Subcategory.INFILLING, 'audio-inpainting', 'diffusion', 'restoration'],
|
| 262 |
)
|
| 263 |
|
| 264 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 265 |
if __name__ == "__main__":
|
| 266 |
+
with gr.Blocks() as demo:
|
| 267 |
+
input_components = [
|
| 268 |
+
gr.Audio(type="filepath", label="Input Audio").harp_required(True),
|
| 269 |
+
gr.Dropdown(
|
| 270 |
+
choices=list(CHECKPOINTS.keys()),
|
| 271 |
+
value="MAESTRO (solo piano)",
|
| 272 |
+
label="Model",
|
| 273 |
+
info="Which checkpoint to inpaint with.",
|
| 274 |
+
),
|
| 275 |
+
gr.Slider(minimum=0.05, maximum=3.0, step=0.05, value=1.5, label="Gap Length (s)",
|
| 276 |
+
info="Length of the gap to fill (default: 1.5s, per repo config)"),
|
| 277 |
+
gr.Number(value=-1, label="Gap Position (s)",
|
| 278 |
+
info="Where the gap starts, from the beginning of the processed segment. -1 = centered (default, per repo config)"),
|
| 279 |
+
gr.Slider(minimum=10, maximum=150, step=1, value=35, label="Processing Steps",
|
| 280 |
+
info="Diffusion sampling steps (default: T=35, per repo config)"),
|
| 281 |
+
gr.Slider(minimum=0.0, maximum=1.0, step=0.05, value=0.25, label="Reconstruction Guidance",
|
| 282 |
+
info="How strongly the output is pulled toward the surrounding audio (default: ξ=0.25, per repo config)"),
|
| 283 |
+
]
|
| 284 |
+
output_components = [
|
| 285 |
+
gr.Audio(type="filepath", label="Output Audio").set_info(
|
| 286 |
+
"The processed segment with the gap filled in."
|
| 287 |
+
),
|
| 288 |
+
]
|
| 289 |
+
|
| 290 |
+
build_endpoint(
|
| 291 |
+
model_card=model_card,
|
| 292 |
+
input_components=input_components,
|
| 293 |
+
output_components=output_components,
|
| 294 |
+
process_fn=process_fn,
|
| 295 |
+
)
|
| 296 |
+
|
| 297 |
+
demo.queue().launch(show_error=True, share=True, pwa=True)
|
requirements.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
git+https://github.com/TEAMuP-dev/pyharp.git@v0.
|
| 2 |
cqt_nsgt_pytorch
|
| 3 |
einops
|
| 4 |
torch
|
|
@@ -7,3 +7,4 @@ omegaconf
|
|
| 7 |
soundfile
|
| 8 |
numpy
|
| 9 |
scipy
|
|
|
|
|
|
| 1 |
+
git+https://github.com/TEAMuP-dev/pyharp.git@v0.4.0
|
| 2 |
cqt_nsgt_pytorch
|
| 3 |
einops
|
| 4 |
torch
|
|
|
|
| 7 |
soundfile
|
| 8 |
numpy
|
| 9 |
scipy
|
| 10 |
+
spaces>=0.51.1
|