harp-dev commited on
Commit
21afacb
·
verified ·
1 Parent(s): 5a4d504

Return to the previous compatible pair: transformers 5 collides with the vendored xcodec config

Browse files
Files changed (3) hide show
  1. README.md +1 -1
  2. app.py +46 -47
  3. requirements.txt +2 -2
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 🎤
4
  colorFrom: pink
5
  colorTo: purple
6
  sdk: gradio
7
- sdk_version: 6.24.0
8
  python_version: '3.11'
9
  app_file: app.py
10
  pinned: false
 
4
  colorFrom: pink
5
  colorTo: purple
6
  sdk: gradio
7
+ sdk_version: 5.28.0
8
  python_version: '3.11'
9
  app_file: app.py
10
  pinned: false
app.py CHANGED
@@ -28,7 +28,6 @@ import soundfile as sf
28
  import torch
29
  from huggingface_hub import hf_hub_download
30
  from pyharp import ModelCard, build_endpoint
31
- from pyharp.tags import Subcategory
32
 
33
  from songgen import (
34
  SongGenDualTrackForConditionalGeneration,
@@ -90,7 +89,7 @@ model_card = ModelCard(
90
  "voice, and it generates a full song."
91
  ),
92
  author="Zihan Liu, Shuangrui Ding, Zhixiong Zhang, Xiaoyi Dong, Pan Zhang, Yuhang Zang, Yuhang Cao, Dahua Lin, Jiaqi Wang",
93
- tags=[Subcategory.HOLISTIC, 'text-to-music', 'song-generation'],
94
  )
95
 
96
 
@@ -156,49 +155,49 @@ def process_fn(mode_name, description, lyrics, ref_voice_path, extract_vocals, t
156
  return song_path, vocals_path
157
 
158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
  if __name__ == "__main__":
160
- with gr.Blocks() as demo:
161
- input_components = [
162
- gr.Dropdown(
163
- choices=list(MODES.keys()),
164
- value="Mixed",
165
- label="Mode",
166
- info="Mixed outputs one finished track; Dual-track also gives you an isolated vocal stem",
167
- ),
168
- gr.Textbox(
169
- label="Music Description",
170
- info="Genre, mood, instruments (e.g. \"upbeat pop song with piano and drums\")",
171
- ),
172
- gr.Textbox(
173
- label="Lyrics",
174
- info="English lyrics for the song (required)",
175
- ),
176
- gr.Audio(type="filepath", label="Reference Voice (optional)").harp_required(False),
177
- gr.Checkbox(
178
- value=True,
179
- label="Extract vocals from reference",
180
- info="(default: True, per repo example) turn off only if the reference audio is already an isolated vocal, not a full mix",
181
- ),
182
- gr.Slider(
183
- minimum=0.1, maximum=2.0, step=0.1, value=1.0,
184
- label="Creativity",
185
- info="(default: 1.0, per repo config) sampling temperature — higher is more varied/unpredictable, lower is safer/more repetitive",
186
- ),
187
- ]
188
- output_components = [
189
- gr.Audio(type="filepath", label="Song").set_info(
190
- "The generated song. In Dual-track mode this is vocals + accompaniment combined."
191
- ),
192
- gr.Audio(type="filepath", label="Isolated Vocals").set_info(
193
- "Vocal-only stem. Only populated in Dual-track mode; silent in Mixed mode."
194
- ),
195
- ]
196
-
197
- build_endpoint(
198
- model_card=model_card,
199
- input_components=input_components,
200
- output_components=output_components,
201
- process_fn=process_fn,
202
- )
203
-
204
- demo.queue().launch(show_error=True, share=True, pwa=True)
 
28
  import torch
29
  from huggingface_hub import hf_hub_download
30
  from pyharp import ModelCard, build_endpoint
 
31
 
32
  from songgen import (
33
  SongGenDualTrackForConditionalGeneration,
 
89
  "voice, and it generates a full song."
90
  ),
91
  author="Zihan Liu, Shuangrui Ding, Zhixiong Zhang, Xiaoyi Dong, Pan Zhang, Yuhang Zang, Yuhang Cao, Dahua Lin, Jiaqi Wang",
92
+ tags=["text-to-music", "song-generation"],
93
  )
94
 
95
 
 
155
  return song_path, vocals_path
156
 
157
 
158
+ with gr.Blocks() as demo:
159
+ input_components = [
160
+ gr.Dropdown(
161
+ choices=list(MODES.keys()),
162
+ value="Mixed",
163
+ label="Mode",
164
+ info="Mixed outputs one finished track; Dual-track also gives you an isolated vocal stem",
165
+ ),
166
+ gr.Textbox(
167
+ label="Music Description",
168
+ info="Genre, mood, instruments (e.g. \"upbeat pop song with piano and drums\")",
169
+ ),
170
+ gr.Textbox(
171
+ label="Lyrics",
172
+ info="English lyrics for the song (required)",
173
+ ),
174
+ gr.Audio(type="filepath", label="Reference Voice (optional)").harp_required(False),
175
+ gr.Checkbox(
176
+ value=True,
177
+ label="Extract vocals from reference",
178
+ info="(default: True, per repo example) turn off only if the reference audio is already an isolated vocal, not a full mix",
179
+ ),
180
+ gr.Slider(
181
+ minimum=0.1, maximum=2.0, step=0.1, value=1.0,
182
+ label="Creativity",
183
+ info="(default: 1.0, per repo config) sampling temperature — higher is more varied/unpredictable, lower is safer/more repetitive",
184
+ ),
185
+ ]
186
+ output_components = [
187
+ gr.Audio(type="filepath", label="Song").set_info(
188
+ "The generated song. In Dual-track mode this is vocals + accompaniment combined."
189
+ ),
190
+ gr.Audio(type="filepath", label="Isolated Vocals").set_info(
191
+ "Vocal-only stem. Only populated in Dual-track mode; silent in Mixed mode."
192
+ ),
193
+ ]
194
+
195
+ build_endpoint(
196
+ model_card=model_card,
197
+ input_components=input_components,
198
+ output_components=output_components,
199
+ process_fn=process_fn,
200
+ )
201
+
202
  if __name__ == "__main__":
203
+ demo.queue().launch(pwa=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
requirements.txt CHANGED
@@ -1,8 +1,8 @@
1
- git+https://github.com/TEAMuP-dev/pyharp.git@v0.4.0
2
  # model-specific deps below:
3
  torch==2.8.0
4
  torchaudio==2.8.0
5
- transformers==5.17.0
6
  sentencepiece==0.2.2
7
  descript-audio-codec==1.0.0
8
  descript-audiotools==0.7.2
 
1
+ git+https://github.com/TEAMuP-dev/pyharp.git@v0.3.0
2
  # model-specific deps below:
3
  torch==2.8.0
4
  torchaudio==2.8.0
5
+ transformers==4.43.3
6
  sentencepiece==0.2.2
7
  descript-audio-codec==1.0.0
8
  descript-audiotools==0.7.2