YanTianlong commited on
Commit
307f5a9
·
0 Parent(s):

first commit

Browse files
.gitignore ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ __pycache__/
2
+ *.py[cod]
3
+ .env
4
+ .venv/
5
+ venv/
6
+
7
+ # Runtime directories created by the Space bootstrap.
8
+ ComfyUI/
9
+ models/
10
+ outputs/
11
+ tmp/
12
+
13
+ # Hugging Face and model caches should stay outside git.
14
+ .cache/
15
+ hf_cache/
16
+
17
+ # Local media samples and generated artifacts.
18
+ *.mp3
19
+ *.wav
20
+ *.mp4
21
+ *.mov
22
+ *.mkv
23
+ *.srt
README.md ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: VoiceGate
3
+ emoji: ""
4
+ colorFrom: blue
5
+ colorTo: green
6
+ sdk: gradio
7
+ python_version: "3.10"
8
+ app_file: app.py
9
+ hardware: zerogpu
10
+ pinned: false
11
+ ---
12
+
13
+ # VoiceGate HF Space
14
+
15
+ This repository is the Hugging Face Space deployment wrapper for VoiceGate.
16
+
17
+ The upstream VoiceGate project and its ComfyUI workflow are kept under `VoiceGate/`
18
+ for now. The Space runtime will be built around Gradio, ComfyUI, and the
19
+ VoiceBridge custom nodes.
20
+
21
+ Current status: planning and deployment scaffolding.
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+
4
+ def placeholder():
5
+ return (
6
+ "VoiceGate HF Space scaffold is ready. "
7
+ "The ComfyUI runtime and workflow client will be wired in the next step."
8
+ )
9
+
10
+
11
+ with gr.Blocks(title="VoiceGate") as demo:
12
+ gr.Markdown("# VoiceGate")
13
+ gr.Markdown("Hugging Face Space deployment scaffold for the VoiceGate ComfyUI workflow.")
14
+ run = gr.Button("Check scaffold")
15
+ output = gr.Textbox(label="Status")
16
+ run.click(fn=placeholder, outputs=output)
17
+
18
+
19
+ if __name__ == "__main__":
20
+ demo.launch()
assets/.gitkeep ADDED
@@ -0,0 +1 @@
 
 
1
+
custom_nodes/.gitkeep ADDED
@@ -0,0 +1 @@
 
 
1
+
docs/deployment-plan.md ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # VoiceGate HF Space Deployment Plan
2
+
3
+ ## Goal
4
+
5
+ Deploy VoiceGate to a Hugging Face Space with a Gradio interface, using ZeroGPU
6
+ for the GPU-heavy inference path.
7
+
8
+ The initial target is a short-audio workflow that proves the full chain:
9
+ audio input -> source separation -> ASR/SRT -> LLM translation -> VoxCPM TTS ->
10
+ SRT-aligned audio merge -> audio and subtitle outputs.
11
+
12
+ ## Repository Roles
13
+
14
+ Use three clear ownership boundaries:
15
+
16
+ - `VoiceGate`: upstream project assets, README, diagrams, and source workflows.
17
+ - `comfyui_voicebridge`: the VoiceBridge ComfyUI custom node repository.
18
+ - `VoiceGate-hf`: this repository, the Hugging Face Space deployment wrapper.
19
+
20
+ The Space repository should not depend on nested git repositories at runtime.
21
+ For deployment, copy or vendor only the required workflow files, custom nodes,
22
+ bootstrap scripts, and Gradio application code into the Space layout.
23
+
24
+ Current local state:
25
+
26
+ - The outer `VoiceGate-hf` repository has no commits yet.
27
+ - `VoiceGate/` is present as a nested upstream repository.
28
+ - `VoiceGate/.gitmodules` references `comfyui_voicebridge`, but the local
29
+ `VoiceGate/comfyui_voicebridge/` directory is currently empty.
30
+ - `VoiceGate/workflows/VoiceGate-Workflow.json` is the UI workflow.
31
+ - `VoiceGate/workflows/VoiceGate-Workflow_api.json` exists, but currently fails
32
+ JSON parsing and must be re-exported or repaired before API execution.
33
+
34
+ ## Hugging Face Space Constraints
35
+
36
+ ZeroGPU Spaces are intended for Gradio SDK Spaces. The Gradio app should expose
37
+ a normal `app.py`, and GPU-heavy functions should be wrapped with `@spaces.GPU`.
38
+
39
+ This means the first implementation should prefer:
40
+
41
+ - Gradio Space root files: `README.md`, `app.py`, `requirements.txt`,
42
+ `packages.txt`.
43
+ - A Python bootstrap that installs or prepares ComfyUI and custom nodes.
44
+ - A workflow client that calls the local ComfyUI API from inside the Gradio
45
+ handler.
46
+
47
+ Avoid starting with a Docker Space for ZeroGPU, even though Docker would be a
48
+ cleaner fit for a long-running ComfyUI service.
49
+
50
+ ## Proposed Space Layout
51
+
52
+ ```text
53
+ VoiceGate-hf/
54
+ |-- README.md
55
+ |-- app.py
56
+ |-- requirements.txt
57
+ |-- packages.txt
58
+ |-- scripts/
59
+ | |-- bootstrap_comfy.py
60
+ | |-- run_comfy.py
61
+ | `-- workflow_client.py
62
+ |-- workflows/
63
+ | |-- voicegate_api.json
64
+ | `-- voicegate_ui.json
65
+ |-- custom_nodes/
66
+ | `-- comfyui_voicebridge/
67
+ |-- assets/
68
+ `-- docs/
69
+ `-- deployment-plan.md
70
+ ```
71
+
72
+ The current repository has only the root scaffold and this plan. The later
73
+ steps should move/copy deployment-ready workflow files into `workflows/` and
74
+ custom nodes into `custom_nodes/`.
75
+
76
+ ## Known Workflow Nodes
77
+
78
+ The API workflow references these important node classes:
79
+
80
+ - `LoadAudio`
81
+ - `MelBandRoFormerModelLoader`
82
+ - `MelBandRoFormerSampler`
83
+ - `VoiceBridgeASRLoader`
84
+ - `VoiceBridgeASRTranscribe`
85
+ - `GenerateSRT`
86
+ - `RH_LLMAPI_NODE`
87
+ - `VoiceBridgeSRTSplitter`
88
+ - `RunningHub_VoxCPM_LoadModel`
89
+ - `RunningHub_VoxCPM_Generate`
90
+ - `VoiceBridgeAudioListMergerBySRT`
91
+ - `MergeAudioMW`
92
+ - `SaveAudioMP3`
93
+ - `SaveSRTFromString`
94
+ - `TrimAudioDuration`
95
+ - `Any Switch (rgthree)`
96
+ - `easy showAnything`
97
+ - `easy string`
98
+ - `CR Text`
99
+ - `ReplaceText`
100
+
101
+ This implies dependencies on VoiceBridge, VoxCPM/RunningHub nodes,
102
+ MelBandRoFormer nodes/models, rgthree, easy-use, and the LLM API node package.
103
+
104
+ ## Model and Secret Inventory
105
+
106
+ Expected model assets:
107
+
108
+ - `Qwen/Qwen3-ASR-1.7B`
109
+ - `Qwen/Qwen3-ForcedAligner-0.6B`
110
+ - `VoxCPM2`
111
+ - `MelBandRoFormer_comfy/MelBandRoformer_fp32.safetensors`
112
+
113
+ Expected Space secrets:
114
+
115
+ - `HF_TOKEN`, if private or gated model downloads are needed.
116
+ - `DEEPSEEK_API_KEY` or another LLM provider key.
117
+ - Optional LLM base URL and model name configuration.
118
+
119
+ Do not commit model weights, API keys, generated audio, or generated subtitles.
120
+
121
+ ## Implementation Phases
122
+
123
+ ### Phase 1: Scaffold and Planning
124
+
125
+ Done in this step:
126
+
127
+ - Add HF Space root files.
128
+ - Add minimal Gradio placeholder.
129
+ - Add deployment plan.
130
+ - Add ignore rules for runtime and generated artifacts.
131
+
132
+ ### Phase 2: Runtime Bootstrap
133
+
134
+ Create scripts that can:
135
+
136
+ - Clone or install ComfyUI.
137
+ - Install Python dependencies.
138
+ - Install required custom nodes at pinned commits.
139
+ - Download or locate required model files.
140
+ - Start ComfyUI locally inside the Space process.
141
+
142
+ ### Phase 3: Workflow Hygiene
143
+
144
+ Repair or re-export `VoiceGate-Workflow_api.json` so it is valid API JSON.
145
+
146
+ Required edits:
147
+
148
+ - Remove stale demo file references.
149
+ - Replace hard-coded audio filenames with Gradio-uploaded input paths.
150
+ - Replace empty API keys with environment variables.
151
+ - Parameterize target language, LLM model, and provider base URL.
152
+ - Ensure output nodes produce deterministic file paths.
153
+
154
+ ### Phase 4: Gradio Integration
155
+
156
+ Build the first real interface:
157
+
158
+ - Input audio file.
159
+ - Target language selector/text input.
160
+ - Source language, default `auto`.
161
+ - Optional prompt override.
162
+ - Output audio.
163
+ - Output translated/adjusted SRT.
164
+ - Runtime log.
165
+
166
+ Wrap the end-to-end function with `@spaces.GPU(duration=...)` and start with a
167
+ short maximum input duration.
168
+
169
+ ### Phase 5: Verification
170
+
171
+ Verify in this order:
172
+
173
+ 1. ComfyUI starts and exposes its local API.
174
+ 2. TTS-only minimal workflow runs.
175
+ 3. ASR-only short audio workflow runs.
176
+ 4. SRT splitter + VoxCPM + merger runs.
177
+ 5. Full VoiceGate short-audio workflow runs.
178
+ 6. Video input support is added after the audio path is stable.
179
+
180
+ ## Immediate Next Step
181
+
182
+ Prepare the runtime bootstrap scripts and decide whether to vendor custom nodes
183
+ into `custom_nodes/` or download pinned commits during Space startup.
packages.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ ffmpeg
2
+ git
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ gradio
2
+ spaces
3
+ requests
4
+ websocket-client
5
+ huggingface_hub
scripts/.gitkeep ADDED
@@ -0,0 +1 @@
 
 
1
+
workflows/.gitkeep ADDED
@@ -0,0 +1 @@
 
 
1
+