Spaces:
Paused
Paused
Deploy HARP wrapper via model agent
Browse files- .harp/manifest.json +30 -0
- README.md +13 -7
- app.py +89 -0
- packages.txt +0 -0
- requirements.txt +3 -0
.harp/manifest.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend_space": "Soul-AILab/SoulX-Singer",
|
| 3 |
+
"deploy_mode": "remote-backend",
|
| 4 |
+
"entry": "app.py",
|
| 5 |
+
"framework": "gradio_client",
|
| 6 |
+
"generated": true,
|
| 7 |
+
"io": {
|
| 8 |
+
"inputs": [
|
| 9 |
+
"audio",
|
| 10 |
+
"audio",
|
| 11 |
+
"dropdown",
|
| 12 |
+
"checkbox",
|
| 13 |
+
"slider",
|
| 14 |
+
"number",
|
| 15 |
+
"dropdown",
|
| 16 |
+
"dropdown",
|
| 17 |
+
"checkbox",
|
| 18 |
+
"checkbox"
|
| 19 |
+
],
|
| 20 |
+
"outputs": [
|
| 21 |
+
"audio",
|
| 22 |
+
"file",
|
| 23 |
+
"file"
|
| 24 |
+
]
|
| 25 |
+
},
|
| 26 |
+
"repo_id": "Soul-AILab/SoulX-Singer",
|
| 27 |
+
"source": "recipe",
|
| 28 |
+
"space_layout": "huggingface-gradio",
|
| 29 |
+
"task": "text-to-audio"
|
| 30 |
+
}
|
README.md
CHANGED
|
@@ -1,13 +1,19 @@
|
|
| 1 |
---
|
| 2 |
-
title: SoulX
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
colorTo: green
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
-
python_version: '3.13'
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: "SoulX-Singer"
|
| 3 |
+
colorFrom: indigo
|
| 4 |
+
colorTo: gray
|
|
|
|
| 5 |
sdk: gradio
|
| 6 |
+
sdk_version: 5.28.0
|
|
|
|
| 7 |
app_file: app.py
|
| 8 |
pinned: false
|
| 9 |
+
license: "apache-2.0"
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# SoulX-Singer
|
| 13 |
+
|
| 14 |
+
SoulX-Singer is a high-fidelity, zero-shot singing voice synthesis model that enables users to generate realistic singing voices for unseen singers. It supports melody-conditioned (F0 contour) and score-conditioned (MIDI notes) control for precise pitch, rhythm, and expression.
|
| 15 |
+
|
| 16 |
+
- Inputs: audio, audio, dropdown, checkbox, slider, number, dropdown, dropdown, checkbox, checkbox
|
| 17 |
+
- Outputs: audio, file, file
|
| 18 |
+
|
| 19 |
+
Generated by the HARP model agent from a recipe.
|
app.py
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
import gradio as gr
|
| 6 |
+
|
| 7 |
+
from pyharp import *
|
| 8 |
+
from gradio_client import Client, handle_file
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
_BACKEND_SPACE = "Soul-AILab/SoulX-Singer"
|
| 12 |
+
_BACKEND_API_NAME = "/synthesis_function"
|
| 13 |
+
_BACKEND_TOKEN_ENV = "HF_TOKEN"
|
| 14 |
+
_client = None
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def _backend_client():
|
| 18 |
+
# Lazily create and cache one warm connection to the backend Space.
|
| 19 |
+
global _client
|
| 20 |
+
if _client is None:
|
| 21 |
+
_token = os.environ.get(_BACKEND_TOKEN_ENV) or None
|
| 22 |
+
_client = Client(_BACKEND_SPACE, hf_token=_token)
|
| 23 |
+
return _client
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
model_card = ModelCard(
|
| 27 |
+
name="SoulX-Singer",
|
| 28 |
+
description="SoulX-Singer is a high-fidelity, zero-shot singing voice synthesis model that enables users to generate realistic singing voices for unseen singers. It supports melody-conditioned (F0 contour) and score-conditioned (MIDI notes) control for precise pitch, rhythm, and expression.",
|
| 29 |
+
author="Soul-AILab",
|
| 30 |
+
tags=["text-to-audio", "music", "singing-voice-synthesis", "svs", "zero-shot", "text-to-speech", "en", "zh"],
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def process_fn(prompt_audio, target_audio, control, auto_shift, pitch_shift, seed, prompt_lyric_lang, target_lyric_lang, prompt_vocal_sep, target_vocal_sep):
|
| 35 |
+
_raw = _backend_client().predict(
|
| 36 |
+
handle_file(prompt_audio),
|
| 37 |
+
handle_file(target_audio),
|
| 38 |
+
None,
|
| 39 |
+
None,
|
| 40 |
+
control,
|
| 41 |
+
auto_shift,
|
| 42 |
+
pitch_shift,
|
| 43 |
+
seed,
|
| 44 |
+
prompt_lyric_lang,
|
| 45 |
+
target_lyric_lang,
|
| 46 |
+
prompt_vocal_sep,
|
| 47 |
+
target_vocal_sep,
|
| 48 |
+
api_name="/synthesis_function",
|
| 49 |
+
)
|
| 50 |
+
_values = list(_raw) if isinstance(_raw, (list, tuple)) else [_raw]
|
| 51 |
+
_detail = " | ".join(str(_v) for _v in _values if isinstance(_v, str) and _v.strip())
|
| 52 |
+
_out_generated_audio = _values[0] if len(_values) > 0 else None
|
| 53 |
+
if not _out_generated_audio:
|
| 54 |
+
raise gr.Error(_detail or "The backend Space returned no 'generated_audio' output. Check the backend Space's logs; if it uses ZeroGPU it may need a moment to warm up.")
|
| 55 |
+
_out_processed_prompt_metadata = _values[1] if len(_values) > 1 else None
|
| 56 |
+
if not _out_processed_prompt_metadata:
|
| 57 |
+
raise gr.Error(_detail or "The backend Space returned no 'processed_prompt_metadata' output. Check the backend Space's logs; if it uses ZeroGPU it may need a moment to warm up.")
|
| 58 |
+
_out_processed_target_metadata = _values[2] if len(_values) > 2 else None
|
| 59 |
+
if not _out_processed_target_metadata:
|
| 60 |
+
raise gr.Error(_detail or "The backend Space returned no 'processed_target_metadata' output. Check the backend Space's logs; if it uses ZeroGPU it may need a moment to warm up.")
|
| 61 |
+
return _out_generated_audio, _out_processed_prompt_metadata, _out_processed_target_metadata
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
with gr.Blocks() as demo:
|
| 65 |
+
input_components = [
|
| 66 |
+
gr.Audio(type="filepath", label="Prompt audio (reference voice), max 30s").set_info("Upload an audio file (max 30 seconds) to provide the reference voice for synthesis."),
|
| 67 |
+
gr.Audio(type="filepath", label="Target audio (melody / lyrics source), max 60s").set_info("Upload an audio file (max 60 seconds) to provide the melody or lyrics source."),
|
| 68 |
+
gr.Dropdown(choices=["melody", "score"], value="melody", label="Control type", info="Choose the control type for synthesis: 'melody' for F0 contour or 'score' for MIDI notes."),
|
| 69 |
+
gr.Checkbox(value=True, label="Auto pitch shift", info="Automatically adjust pitch shift to match the target audio's range."),
|
| 70 |
+
gr.Slider(minimum=-12, maximum=12, step=1, value=0, label="Pitch shift (semitones)", info="Manually adjust the pitch shift in semitones. Auto pitch shift will be ignored if a non-zero value is set."),
|
| 71 |
+
gr.Number(value=12306, label="Seed", info="Random seed for reproducibility."),
|
| 72 |
+
gr.Dropdown(choices=["English", "Chinese"], value="English", label="Prompt lyric language", info="Select the language of the lyrics in the prompt audio."),
|
| 73 |
+
gr.Dropdown(choices=["English", "Chinese"], value="English", label="Target lyric language", info="Select the language of the lyrics in the target audio."),
|
| 74 |
+
gr.Checkbox(value=False, label="Prompt vocal separation", info="Enable vocal separation for the prompt audio if it contains accompaniment."),
|
| 75 |
+
gr.Checkbox(value=True, label="Target vocal separation", info="Enable vocal separation for the target audio if it contains accompaniment."),
|
| 76 |
+
]
|
| 77 |
+
output_components = [
|
| 78 |
+
gr.Audio(type="filepath", label="Generated audio").set_info("The synthesized singing voice."),
|
| 79 |
+
gr.File(type="filepath", label="Processed Prompt Metadata", file_types=[".mid", ".midi"]).set_info("Metadata file generated from the prompt audio."),
|
| 80 |
+
gr.File(type="filepath", label="Processed Target Metadata", file_types=[".mid", ".midi"]).set_info("Metadata file generated from the target audio."),
|
| 81 |
+
]
|
| 82 |
+
build_endpoint(
|
| 83 |
+
model_card=model_card,
|
| 84 |
+
input_components=input_components,
|
| 85 |
+
output_components=output_components,
|
| 86 |
+
process_fn=process_fn,
|
| 87 |
+
)
|
| 88 |
+
|
| 89 |
+
demo.queue().launch(share=True, show_error=False, pwa=True)
|
packages.txt
ADDED
|
File without changes
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
git+https://github.com/TEAMuP-dev/pyharp.git@v0.3.0
|
| 2 |
+
gradio>=4.0
|
| 3 |
+
gradio_client
|