rlackey Claude Opus 4.5 commited on
Commit
e629dee
·
1 Parent(s): e530697

Fix runtime errors - make AI Studio optional

Browse files

- Wrap ai_studio import in try/except
- Remove audiocraft/xformers from requirements (causing build failures)
- AI Studio will show "not available" message until audiocraft works
- Core features (stems, chords, mastering) still work

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Files changed (2) hide show
  1. app.py +21 -5
  2. requirements.txt +0 -2
app.py CHANGED
@@ -43,11 +43,27 @@ from token_system import (
43
  # Import mastering module
44
  from mastering import master_audio, format_analysis, analyze_audio
45
 
46
- # Import AI Studio module
47
- from ai_studio import (
48
- full_training_pipeline, generate_music, generate_with_melody,
49
- get_model_choices, get_trained_models
50
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
  # Optional imports
53
  try:
 
43
  # Import mastering module
44
  from mastering import master_audio, format_analysis, analyze_audio
45
 
46
+ # Import AI Studio module (optional - may fail if audiocraft not available)
47
+ try:
48
+ from ai_studio import (
49
+ full_training_pipeline, generate_music, generate_with_melody,
50
+ get_model_choices, get_trained_models
51
+ )
52
+ HAS_AI_STUDIO = True
53
+ except ImportError as e:
54
+ print(f"AI Studio not available: {e}")
55
+ HAS_AI_STUDIO = False
56
+ # Stub functions
57
+ def full_training_pipeline(*args, **kwargs):
58
+ return None, "AI Studio not available - audiocraft not installed"
59
+ def generate_music(*args, **kwargs):
60
+ return None, "AI Studio not available - audiocraft not installed"
61
+ def generate_with_melody(*args, **kwargs):
62
+ return None, "AI Studio not available - audiocraft not installed"
63
+ def get_model_choices():
64
+ return ["musicgen-small (Base)", "musicgen-medium (Base)"]
65
+ def get_trained_models():
66
+ return []
67
 
68
  # Optional imports
69
  try:
requirements.txt CHANGED
@@ -9,5 +9,3 @@ torch>=2.0.0
9
  torchaudio>=2.0.0
10
  demucs>=4.0.0
11
  pyloudnorm>=0.1.0
12
- audiocraft>=1.3.0
13
- xformers>=0.0.22
 
9
  torchaudio>=2.0.0
10
  demucs>=4.0.0
11
  pyloudnorm>=0.1.0