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 +41 -41
- requirements.txt +1 -0
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: 🎛️
|
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: gray
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
python_version: '3.11'
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
|
|
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: gray
|
| 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
|
@@ -25,7 +25,7 @@ import soundfile as sf
|
|
| 25 |
import torch
|
| 26 |
import torchaudio
|
| 27 |
import gradio as gr
|
| 28 |
-
from pyharp import ModelCard, build_endpoint
|
| 29 |
|
| 30 |
import stemfx
|
| 31 |
from stemfx.separator import SCNetSeparator
|
|
@@ -49,7 +49,7 @@ model_card = ModelCard(
|
|
| 49 |
"the song's character changes partway through."
|
| 50 |
),
|
| 51 |
author="Yuan-Chiao Cheng, Jui-Te Wu, Brian Chen, Yen-Tung Yeh, Yu-Hua Chen, Yi-Hsuan Yang",
|
| 52 |
-
tags=[
|
| 53 |
)
|
| 54 |
|
| 55 |
_model = None
|
|
@@ -190,43 +190,43 @@ def process_fn(
|
|
| 190 |
return audio_path, chain_path
|
| 191 |
|
| 192 |
|
| 193 |
-
with gr.Blocks() as demo:
|
| 194 |
-
input_components = [
|
| 195 |
-
gr.Audio(type="filepath", label="Original Mix")
|
| 196 |
-
.harp_required(True)
|
| 197 |
-
.set_info("The mix to restyle. Effects are chosen using its first 10 seconds, then applied to the whole track."),
|
| 198 |
-
gr.Audio(type="filepath", label="Reference Mix")
|
| 199 |
-
.harp_required(True)
|
| 200 |
-
.set_info("The mix whose sound/style to copy. Only its first 10 seconds are used."),
|
| 201 |
-
gr.Checkbox(
|
| 202 |
-
value=True,
|
| 203 |
-
label="Normalize Output Loudness",
|
| 204 |
-
info="Normalize output to a target loudness (default: True, per repo config)",
|
| 205 |
-
),
|
| 206 |
-
gr.Slider(
|
| 207 |
-
minimum=-36,
|
| 208 |
-
maximum=-9,
|
| 209 |
-
step=0.5,
|
| 210 |
-
value=-23.0,
|
| 211 |
-
label="Target Loudness (LUFS)",
|
| 212 |
-
info="Loudness target used when normalization is enabled (default: -23.0, per repo config)",
|
| 213 |
-
),
|
| 214 |
-
]
|
| 215 |
-
output_components = [
|
| 216 |
-
gr.Audio(type="filepath", label="Processed Mix").set_info(
|
| 217 |
-
"Full original mix, re-rendered with the predicted FX chain in the reference's style."
|
| 218 |
-
),
|
| 219 |
-
gr.File(type="filepath", file_types=[".txt"], label="FX Chain").set_info(
|
| 220 |
-
"Human-readable per-stem effects chain predicted by the model."
|
| 221 |
-
),
|
| 222 |
-
]
|
| 223 |
-
|
| 224 |
-
build_endpoint(
|
| 225 |
-
model_card=model_card,
|
| 226 |
-
input_components=input_components,
|
| 227 |
-
output_components=output_components,
|
| 228 |
-
process_fn=process_fn,
|
| 229 |
-
)
|
| 230 |
-
|
| 231 |
if __name__ == "__main__":
|
| 232 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
import torch
|
| 26 |
import torchaudio
|
| 27 |
import gradio as gr
|
| 28 |
+
from pyharp import ModelCard, build_endpoint, Subcategory
|
| 29 |
|
| 30 |
import stemfx
|
| 31 |
from stemfx.separator import SCNetSeparator
|
|
|
|
| 49 |
"the song's character changes partway through."
|
| 50 |
),
|
| 51 |
author="Yuan-Chiao Cheng, Jui-Te Wu, Brian Chen, Yen-Tung Yeh, Yu-Hua Chen, Yi-Hsuan Yang",
|
| 52 |
+
tags=[Subcategory.MIXING_STYLE_TRANSFER, 'audio-effects', 'mixing', 'style-transfer'],
|
| 53 |
)
|
| 54 |
|
| 55 |
_model = None
|
|
|
|
| 190 |
return audio_path, chain_path
|
| 191 |
|
| 192 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 193 |
if __name__ == "__main__":
|
| 194 |
+
with gr.Blocks() as demo:
|
| 195 |
+
input_components = [
|
| 196 |
+
gr.Audio(type="filepath", label="Original Mix")
|
| 197 |
+
.harp_required(True)
|
| 198 |
+
.set_info("The mix to restyle. Effects are chosen using its first 10 seconds, then applied to the whole track."),
|
| 199 |
+
gr.Audio(type="filepath", label="Reference Mix")
|
| 200 |
+
.harp_required(True)
|
| 201 |
+
.set_info("The mix whose sound/style to copy. Only its first 10 seconds are used."),
|
| 202 |
+
gr.Checkbox(
|
| 203 |
+
value=True,
|
| 204 |
+
label="Normalize Output Loudness",
|
| 205 |
+
info="Normalize output to a target loudness (default: True, per repo config)",
|
| 206 |
+
),
|
| 207 |
+
gr.Slider(
|
| 208 |
+
minimum=-36,
|
| 209 |
+
maximum=-9,
|
| 210 |
+
step=0.5,
|
| 211 |
+
value=-23.0,
|
| 212 |
+
label="Target Loudness (LUFS)",
|
| 213 |
+
info="Loudness target used when normalization is enabled (default: -23.0, per repo config)",
|
| 214 |
+
),
|
| 215 |
+
]
|
| 216 |
+
output_components = [
|
| 217 |
+
gr.Audio(type="filepath", label="Processed Mix").set_info(
|
| 218 |
+
"Full original mix, re-rendered with the predicted FX chain in the reference's style."
|
| 219 |
+
),
|
| 220 |
+
gr.File(type="filepath", file_types=[".txt"], label="FX Chain").set_info(
|
| 221 |
+
"Human-readable per-stem effects chain predicted by the model."
|
| 222 |
+
),
|
| 223 |
+
]
|
| 224 |
+
|
| 225 |
+
build_endpoint(
|
| 226 |
+
model_card=model_card,
|
| 227 |
+
input_components=input_components,
|
| 228 |
+
output_components=output_components,
|
| 229 |
+
process_fn=process_fn,
|
| 230 |
+
)
|
| 231 |
+
|
| 232 |
+
demo.queue().launch(show_error=True, share=True, pwa=True)
|
requirements.txt
CHANGED
|
@@ -2,3 +2,4 @@ git+https://github.com/TEAMuP-dev/pyharp.git@v0.4.0
|
|
| 2 |
|
| 3 |
# model-specific deps below:
|
| 4 |
stemfx==0.2.0
|
|
|
|
|
|
| 2 |
|
| 3 |
# model-specific deps below:
|
| 4 |
stemfx==0.2.0
|
| 5 |
+
spaces>=0.51.1
|