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 +33 -32
- requirements.txt +2 -1
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: 📻
|
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: green
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
python_version: '3.11'
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
|
|
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: green
|
| 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
|
@@ -24,7 +24,7 @@ import torch
|
|
| 24 |
import torchaudio
|
| 25 |
from huggingface_hub import hf_hub_download
|
| 26 |
from omegaconf import OmegaConf
|
| 27 |
-
from pyharp import ModelCard, build_endpoint
|
| 28 |
|
| 29 |
from model.config import CHECKPOINTS, CHECKPOINTS_REPO
|
| 30 |
from model.cqtdiff import Unet_CQT_oct_with_attention
|
|
@@ -66,7 +66,7 @@ model_card = ModelCard(
|
|
| 66 |
name="BABE-2",
|
| 67 |
description="Restores degraded historical piano or singing-voice recordings with a diffusion-based generative equalizer.",
|
| 68 |
author="Eloi Moliner, Maija Turunen, Filip Elvander, Vesa Välimäki",
|
| 69 |
-
tags=[
|
| 70 |
)
|
| 71 |
|
| 72 |
|
|
@@ -104,33 +104,34 @@ def update_strength_default(checkpoint_label):
|
|
| 104 |
return gr.update(value=float(base_cfg.tester.posterior_sampling.xi))
|
| 105 |
|
| 106 |
|
| 107 |
-
|
| 108 |
-
|
| 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 |
-
|
| 136 |
-
|
|
|
|
|
|
| 24 |
import torchaudio
|
| 25 |
from huggingface_hub import hf_hub_download
|
| 26 |
from omegaconf import OmegaConf
|
| 27 |
+
from pyharp import ModelCard, build_endpoint, Subcategory
|
| 28 |
|
| 29 |
from model.config import CHECKPOINTS, CHECKPOINTS_REPO
|
| 30 |
from model.cqtdiff import Unet_CQT_oct_with_attention
|
|
|
|
| 66 |
name="BABE-2",
|
| 67 |
description="Restores degraded historical piano or singing-voice recordings with a diffusion-based generative equalizer.",
|
| 68 |
author="Eloi Moliner, Maija Turunen, Filip Elvander, Vesa Välimäki",
|
| 69 |
+
tags=[Subcategory.RESTORATION, 'restoration', 'equalizer', 'diffusion', 'historical recordings'],
|
| 70 |
)
|
| 71 |
|
| 72 |
|
|
|
|
| 104 |
return gr.update(value=float(base_cfg.tester.posterior_sampling.xi))
|
| 105 |
|
| 106 |
|
| 107 |
+
if __name__ == "__main__":
|
| 108 |
+
with gr.Blocks() as demo:
|
| 109 |
+
checkpoint_dropdown = gr.Dropdown(
|
| 110 |
+
choices=list(CHECKPOINTS.keys()),
|
| 111 |
+
value="Piano (MAESTRO)",
|
| 112 |
+
label="Voice / Instrument",
|
| 113 |
+
info="Singer-specific models give the most faithful restoration when your recording actually resembles that singer.",
|
| 114 |
+
)
|
| 115 |
+
|
| 116 |
+
input_components = [
|
| 117 |
+
gr.Audio(type="filepath", label="Input Audio").harp_required(True),
|
| 118 |
+
checkpoint_dropdown,
|
| 119 |
+
gr.Slider(minimum=10, maximum=100, step=1, value=51, label="Processing Steps",
|
| 120 |
+
info="More steps can improve quality at the cost of processing time."),
|
| 121 |
+
gr.Slider(minimum=0.0, maximum=2.0, step=0.05, value=1.0, label="Restoration Strength",
|
| 122 |
+
info="How strongly the output is guided to match the input recording."),
|
| 123 |
+
]
|
| 124 |
+
output_components = [
|
| 125 |
+
gr.Audio(type="filepath", label="Restored Audio").set_info("The restored recording."),
|
| 126 |
+
]
|
| 127 |
+
|
| 128 |
+
checkpoint_dropdown.change(fn=update_strength_default, inputs=checkpoint_dropdown, outputs=input_components[3])
|
| 129 |
+
|
| 130 |
+
build_endpoint(
|
| 131 |
+
model_card=model_card,
|
| 132 |
+
input_components=input_components,
|
| 133 |
+
output_components=output_components,
|
| 134 |
+
process_fn=process_fn,
|
| 135 |
+
)
|
| 136 |
+
|
| 137 |
+
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 |
torch
|
| 3 |
torchaudio
|
| 4 |
numpy
|
|
@@ -7,3 +7,4 @@ soundfile
|
|
| 7 |
tqdm
|
| 8 |
omegaconf
|
| 9 |
huggingface_hub
|
|
|
|
|
|
| 1 |
+
git+https://github.com/TEAMuP-dev/pyharp.git@v0.4.0
|
| 2 |
torch
|
| 3 |
torchaudio
|
| 4 |
numpy
|
|
|
|
| 7 |
tqdm
|
| 8 |
omegaconf
|
| 9 |
huggingface_hub
|
| 10 |
+
spaces>=0.51.1
|