Update app.py
Browse files
app.py
CHANGED
|
@@ -4,15 +4,7 @@ import os
|
|
| 4 |
import shutil
|
| 5 |
import tempfile
|
| 6 |
|
| 7 |
-
""
|
| 8 |
-
# Set the PATH and LD_LIBRARY_PATH for CUDA 12.3
|
| 9 |
-
cuda_bin_path = "/usr/local/cuda/bin"
|
| 10 |
-
cuda_lib_path = "/usr/local/cuda/lib64"
|
| 11 |
-
|
| 12 |
-
# Update the environment variables
|
| 13 |
-
os.environ['PATH'] = f"{cuda_bin_path}:{os.environ.get('PATH', '')}"
|
| 14 |
-
os.environ['LD_LIBRARY_PATH'] = f"{cuda_lib_path}:{os.environ.get('LD_LIBRARY_PATH', '')}"
|
| 15 |
-
"""
|
| 16 |
|
| 17 |
# Install required package
|
| 18 |
def install_flash_attn():
|
|
@@ -136,7 +128,7 @@ def infer(genre_txt_content, lyrics_txt_content, num_segments, max_new_tokens):
|
|
| 136 |
"--output_dir", f"{output_dir}",
|
| 137 |
"--cuda_idx", "0",
|
| 138 |
"--max_new_tokens", f"{max_new_tokens}",
|
| 139 |
-
"--disable_offload_model"
|
| 140 |
]
|
| 141 |
|
| 142 |
# Set up environment variables for CUDA with optimized settings
|
|
@@ -187,7 +179,20 @@ def infer(genre_txt_content, lyrics_txt_content, num_segments, max_new_tokens):
|
|
| 187 |
|
| 188 |
with gr.Blocks() as demo:
|
| 189 |
with gr.Column():
|
| 190 |
-
gr.Markdown("# YuE")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 191 |
with gr.Row():
|
| 192 |
with gr.Column():
|
| 193 |
genre_txt = gr.Textbox(label="Genre")
|
|
@@ -207,20 +212,18 @@ Don't let this moment fade, hold me close tonight
|
|
| 207 |
With you here beside me, everything's alright
|
| 208 |
Can't imagine life alone, don't want to let you go
|
| 209 |
Stay with me forever, let our love just flow
|
| 210 |
-
|
| 211 |
-
[verse]
|
| 212 |
-
Moonlight paints a picture upon your lovely face
|
| 213 |
-
Every glance between us fills the empty space
|
| 214 |
-
Time stands still around us when you're in my arms
|
| 215 |
-
Nothing else can matter, safe from any harm
|
| 216 |
"""
|
| 217 |
]
|
| 218 |
],
|
| 219 |
inputs = [genre_txt, lyrics_txt]
|
| 220 |
)
|
| 221 |
with gr.Column():
|
| 222 |
-
|
| 223 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
submit_btn = gr.Button("Submit")
|
| 225 |
music_out = gr.Audio(label="Audio Result")
|
| 226 |
|
|
|
|
| 4 |
import shutil
|
| 5 |
import tempfile
|
| 6 |
|
| 7 |
+
is_shared_ui = True if "fffiloni/YuE" in os.environ['SPACE_ID'] else False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
# Install required package
|
| 10 |
def install_flash_attn():
|
|
|
|
| 128 |
"--output_dir", f"{output_dir}",
|
| 129 |
"--cuda_idx", "0",
|
| 130 |
"--max_new_tokens", f"{max_new_tokens}",
|
| 131 |
+
#"--disable_offload_model"
|
| 132 |
]
|
| 133 |
|
| 134 |
# Set up environment variables for CUDA with optimized settings
|
|
|
|
| 179 |
|
| 180 |
with gr.Blocks() as demo:
|
| 181 |
with gr.Column():
|
| 182 |
+
gr.Markdown("# YuE: Open Music Foundation Models for Full-Song Generation")
|
| 183 |
+
gr.HTML("""
|
| 184 |
+
<div style="display:flex;column-gap:4px;">
|
| 185 |
+
<a href="https://github.com/multimodal-art-projection/YuE">
|
| 186 |
+
<img src='https://img.shields.io/badge/GitHub-Repo-blue'>
|
| 187 |
+
</a>
|
| 188 |
+
<a href="https://map-yue.github.io">
|
| 189 |
+
<img src='https://img.shields.io/badge/Project-Page-green'>
|
| 190 |
+
</a>
|
| 191 |
+
<a href="https://huggingface.co/spaces/fffiloni/YuE?duplicate=true">
|
| 192 |
+
<img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/duplicate-this-space-sm.svg" alt="Duplicate this Space">
|
| 193 |
+
</a>
|
| 194 |
+
</div>
|
| 195 |
+
""")
|
| 196 |
with gr.Row():
|
| 197 |
with gr.Column():
|
| 198 |
genre_txt = gr.Textbox(label="Genre")
|
|
|
|
| 212 |
With you here beside me, everything's alright
|
| 213 |
Can't imagine life alone, don't want to let you go
|
| 214 |
Stay with me forever, let our love just flow
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 215 |
"""
|
| 216 |
]
|
| 217 |
],
|
| 218 |
inputs = [genre_txt, lyrics_txt]
|
| 219 |
)
|
| 220 |
with gr.Column():
|
| 221 |
+
if is_shared_ui:
|
| 222 |
+
num_segments = gr.Number(label="Number of Song Segments", value=2, interactive=False)
|
| 223 |
+
max_new_tokens = gr.Slider(label="Max New Tokens", minimum=500, maximum="24000", step=500, value=3000, interactive=False)
|
| 224 |
+
else:
|
| 225 |
+
num_segments = gr.Number(label="Number of Song Segments", value=2, interactive=True)
|
| 226 |
+
max_new_tokens = gr.Slider(label="Max New Tokens", minimum=500, maximum="24000", step=500, value=3000, interactive=True)
|
| 227 |
submit_btn = gr.Button("Submit")
|
| 228 |
music_out = gr.Audio(label="Audio Result")
|
| 229 |
|