Spaces:
Running
Running
futurespyhi
commited on
Commit
Β·
d2e8f1c
1
Parent(s):
88ccf2d
1.use different instrument components for different genre 2.modify estimated time
Browse files
app.py
CHANGED
|
@@ -190,8 +190,29 @@ def generate_music_spaces(lyrics: str, genre: str, mood: str, theme: str, progre
|
|
| 190 |
|
| 191 |
# Create temporary files
|
| 192 |
with tempfile.NamedTemporaryFile(mode='w', suffix='.txt', delete=False) as genre_file:
|
| 193 |
-
#
|
| 194 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
genre_file_path = genre_file.name
|
| 196 |
|
| 197 |
# Convert lyrics format for YuE compatibility
|
|
@@ -275,7 +296,7 @@ def generate_music_spaces(lyrics: str, genre: str, mood: str, theme: str, progre
|
|
| 275 |
|
| 276 |
print("π΅ Starting high-quality music generation...")
|
| 277 |
print(f"π Generation settings: {run_n_segments} segments, {max_new_tokens} tokens, 30s audio")
|
| 278 |
-
print(f"β±οΈ Estimated time:
|
| 279 |
print(f"Working directory: {os.getcwd()}")
|
| 280 |
print(f"Command: {' '.join(cmd)}")
|
| 281 |
|
|
@@ -506,7 +527,7 @@ def build_interface():
|
|
| 506 |
gr.Markdown("""
|
| 507 |
<div class="performance-notice">
|
| 508 |
π <strong>High-Performance Mode:</strong> Running on Spaces GPU with optimized settings for best quality.
|
| 509 |
-
Generation time: ~
|
| 510 |
</div>
|
| 511 |
""")
|
| 512 |
|
|
|
|
| 190 |
|
| 191 |
# Create temporary files
|
| 192 |
with tempfile.NamedTemporaryFile(mode='w', suffix='.txt', delete=False) as genre_file:
|
| 193 |
+
# Add specific instruments based on genre for better itrack generation
|
| 194 |
+
if genre == "pop":
|
| 195 |
+
instruments = "piano electric guitar bass drums synthesizer"
|
| 196 |
+
elif genre == "rock":
|
| 197 |
+
instruments = "electric guitar bass drums guitar"
|
| 198 |
+
elif genre == "jazz":
|
| 199 |
+
instruments = "piano bass drums saxophone"
|
| 200 |
+
elif genre == "classical":
|
| 201 |
+
instruments = "piano violin orchestra"
|
| 202 |
+
elif genre == "electronic":
|
| 203 |
+
instruments = "synthesizer drum machine bass synth"
|
| 204 |
+
elif genre == "folk":
|
| 205 |
+
instruments = "acoustic guitar piano"
|
| 206 |
+
elif genre == "r&b":
|
| 207 |
+
instruments = "piano bass drums electric guitar"
|
| 208 |
+
elif genre == "country":
|
| 209 |
+
instruments = "acoustic guitar bass drums"
|
| 210 |
+
elif genre == "hip-hop":
|
| 211 |
+
instruments = "drum machine bass synthesizer"
|
| 212 |
+
else:
|
| 213 |
+
instruments = "piano electric guitar bass drums" # default
|
| 214 |
+
|
| 215 |
+
genre_file.write(f"{genre} {instruments} {mood} {theme} female airy vocal bright")
|
| 216 |
genre_file_path = genre_file.name
|
| 217 |
|
| 218 |
# Convert lyrics format for YuE compatibility
|
|
|
|
| 296 |
|
| 297 |
print("π΅ Starting high-quality music generation...")
|
| 298 |
print(f"π Generation settings: {run_n_segments} segments, {max_new_tokens} tokens, 30s audio")
|
| 299 |
+
print(f"β±οΈ Estimated time: 10-13 minutes for high-quality generation")
|
| 300 |
print(f"Working directory: {os.getcwd()}")
|
| 301 |
print(f"Command: {' '.join(cmd)}")
|
| 302 |
|
|
|
|
| 527 |
gr.Markdown("""
|
| 528 |
<div class="performance-notice">
|
| 529 |
π <strong>High-Performance Mode:</strong> Running on Spaces GPU with optimized settings for best quality.
|
| 530 |
+
Generation time: ~10-13 minutes for professional-grade music with vocals and instruments.
|
| 531 |
</div>
|
| 532 |
""")
|
| 533 |
|