Spaces:
Running
Running
futurespyhi
commited on
Commit
Β·
47f310c
1
Parent(s):
2e48849
1. modify generated files search logic 2.modify time to 12 mins for H200
Browse files
app.py
CHANGED
|
@@ -287,7 +287,7 @@ def validate_file_structure():
|
|
| 287 |
print("β
All required files found")
|
| 288 |
return True
|
| 289 |
|
| 290 |
-
@spaces.GPU(duration=
|
| 291 |
def generate_music_spaces(lyrics: str, genre: str, mood: str, progress=gr.Progress()) -> str:
|
| 292 |
"""
|
| 293 |
Generate music using YuE model with high-performance Spaces configuration
|
|
@@ -506,14 +506,25 @@ def generate_music_spaces(lyrics: str, genre: str, mood: str, progress=gr.Progre
|
|
| 506 |
os.unlink(lyrics_file_path)
|
| 507 |
|
| 508 |
if result.returncode == 0:
|
| 509 |
-
# Find generated audio file
|
| 510 |
import glob
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 511 |
audio_files = glob.glob(os.path.join(output_dir, "**/*.mp3"), recursive=True)
|
| 512 |
-
|
| 513 |
if audio_files:
|
| 514 |
progress(1.0, desc="Music generation complete!")
|
|
|
|
| 515 |
return audio_files[0] # Return path to generated audio
|
| 516 |
else:
|
|
|
|
|
|
|
| 517 |
return "Music generation completed but no audio file found."
|
| 518 |
else:
|
| 519 |
error_msg = f"Return code: {result.returncode}\n"
|
|
|
|
| 287 |
print("β
All required files found")
|
| 288 |
return True
|
| 289 |
|
| 290 |
+
@spaces.GPU(duration=720)
|
| 291 |
def generate_music_spaces(lyrics: str, genre: str, mood: str, progress=gr.Progress()) -> str:
|
| 292 |
"""
|
| 293 |
Generate music using YuE model with high-performance Spaces configuration
|
|
|
|
| 506 |
os.unlink(lyrics_file_path)
|
| 507 |
|
| 508 |
if result.returncode == 0:
|
| 509 |
+
# Find generated audio file - prioritize mixed audio from vocoder/mix directory
|
| 510 |
import glob
|
| 511 |
+
|
| 512 |
+
# First look for the final mixed audio in vocoder/mix
|
| 513 |
+
mixed_files = glob.glob(os.path.join(output_dir, "vocoder/mix/*_mixed.mp3"))
|
| 514 |
+
if mixed_files:
|
| 515 |
+
progress(1.0, desc="Music generation complete!")
|
| 516 |
+
print(f"β
Found mixed audio file: {mixed_files[0]}")
|
| 517 |
+
return mixed_files[0]
|
| 518 |
+
|
| 519 |
+
# Fallback to any MP3 file
|
| 520 |
audio_files = glob.glob(os.path.join(output_dir, "**/*.mp3"), recursive=True)
|
|
|
|
| 521 |
if audio_files:
|
| 522 |
progress(1.0, desc="Music generation complete!")
|
| 523 |
+
print(f"β
Found audio file: {audio_files[0]}")
|
| 524 |
return audio_files[0] # Return path to generated audio
|
| 525 |
else:
|
| 526 |
+
print(f"β No audio files found in {output_dir}")
|
| 527 |
+
print(f"Directory contents: {os.listdir(output_dir) if os.path.exists(output_dir) else 'Directory not found'}")
|
| 528 |
return "Music generation completed but no audio file found."
|
| 529 |
else:
|
| 530 |
error_msg = f"Return code: {result.returncode}\n"
|