Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -21,7 +21,6 @@ model = Pop2PianoForConditionalGeneration.from_pretrained("sweetcocoa/pop2piano"
|
|
21 |
processor = Pop2PianoProcessor.from_pretrained("sweetcocoa/pop2piano")
|
22 |
composers = model.generation_config.composer_to_feature_token.keys()
|
23 |
|
24 |
-
|
25 |
def get_audio_from_yt_video(yt_link):
|
26 |
try:
|
27 |
yt = pt.YouTube(yt_link)
|
@@ -59,7 +58,7 @@ def prepare_output_file(tokenizer_output, sr):
|
|
59 |
|
60 |
return wav_output, wav_output, midi_output
|
61 |
|
62 |
-
def get_stereo(pop_path, midi, pop_scale=0.
|
63 |
pop_y, sr = librosa.load(pop_path, sr=None)
|
64 |
midi_y, _ = librosa.load(midi.name, sr=None)
|
65 |
|
@@ -134,13 +133,13 @@ with block:
|
|
134 |
<div> <h3> <center> Get the Stereo Mix from the Pop Music and Generated MIDI </h3> </div>
|
135 |
"""
|
136 |
)
|
137 |
-
gr.Slider(0, 1, value=0.5, label="Choose the ratio between Pop and MIDI", info="1.0 = Only Pop, 0.0=Only MIDI"),
|
138 |
stereo_btn = gr.Button("Get Stereo Mix")
|
139 |
with gr.Row():
|
140 |
stereo_mix1 = gr.Audio(label="Listen to the Stereo Mix")
|
141 |
stereo_mix2 = gr.File(label="Download the Stereo Mix")
|
142 |
|
143 |
-
stereo_btn.click(get_stereo, inputs=[file_uploaded, wav_output2], outputs=[stereo_mix1, stereo_mix2])
|
144 |
|
145 |
with gr.Group():
|
146 |
gr.Examples([
|
@@ -167,8 +166,6 @@ with block:
|
|
167 |
<center><p><a href="http://sweetcocoa.github.io/pop2piano_samples" style="text-decoration: underline;" target="_blank">Project Page</a>
|
168 |
<center><a href="https://huggingface.co/docs/transformers/main/model_doc/pop2piano" style="text-decoration: underline;" target="_blank">HuggingFace Model Docs</a>
|
169 |
<center><a href="https://github.com/sweetcocoa/pop2piano" style="text-decoration: underline;" target="_blank">Github</a>
|
170 |
-
|
171 |
-
|
172 |
</p>
|
173 |
</div>
|
174 |
"""
|
|
|
21 |
processor = Pop2PianoProcessor.from_pretrained("sweetcocoa/pop2piano")
|
22 |
composers = model.generation_config.composer_to_feature_token.keys()
|
23 |
|
|
|
24 |
def get_audio_from_yt_video(yt_link):
|
25 |
try:
|
26 |
yt = pt.YouTube(yt_link)
|
|
|
58 |
|
59 |
return wav_output, wav_output, midi_output
|
60 |
|
61 |
+
def get_stereo(pop_path, midi, pop_scale=0.5):
|
62 |
pop_y, sr = librosa.load(pop_path, sr=None)
|
63 |
midi_y, _ = librosa.load(midi.name, sr=None)
|
64 |
|
|
|
133 |
<div> <h3> <center> Get the Stereo Mix from the Pop Music and Generated MIDI </h3> </div>
|
134 |
"""
|
135 |
)
|
136 |
+
pop_scale = gr.Slider(0, 1, value=0.5, label="Choose the ratio between Pop and MIDI", info="1.0 = Only Pop, 0.0=Only MIDI", interactive=True),
|
137 |
stereo_btn = gr.Button("Get Stereo Mix")
|
138 |
with gr.Row():
|
139 |
stereo_mix1 = gr.Audio(label="Listen to the Stereo Mix")
|
140 |
stereo_mix2 = gr.File(label="Download the Stereo Mix")
|
141 |
|
142 |
+
stereo_btn.click(get_stereo, inputs=[file_uploaded, wav_output2, pop_scale[0]], outputs=[stereo_mix1, stereo_mix2])
|
143 |
|
144 |
with gr.Group():
|
145 |
gr.Examples([
|
|
|
166 |
<center><p><a href="http://sweetcocoa.github.io/pop2piano_samples" style="text-decoration: underline;" target="_blank">Project Page</a>
|
167 |
<center><a href="https://huggingface.co/docs/transformers/main/model_doc/pop2piano" style="text-decoration: underline;" target="_blank">HuggingFace Model Docs</a>
|
168 |
<center><a href="https://github.com/sweetcocoa/pop2piano" style="text-decoration: underline;" target="_blank">Github</a>
|
|
|
|
|
169 |
</p>
|
170 |
</div>
|
171 |
"""
|