cocktailpeanut commited on
Commit
f06459f
1 Parent(s): 49f36fd
Files changed (2) hide show
  1. app.py +8 -2
  2. requirements.txt +3 -3
app.py CHANGED
@@ -177,7 +177,13 @@ def generate_music(seed, use_chords, chord_progression, prompt_duration, musicge
177
  seed = random.randint(1, 10000)
178
 
179
  # Check if CUDA is available
180
- device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
 
 
 
 
 
 
181
 
182
  # Define the expandable sections
183
  musiclang_blurb = """
@@ -236,4 +242,4 @@ with gr.Blocks() as iface:
236
 
237
  generate_button.click(generate_music, inputs=[seed, use_chords, chord_progression, prompt_duration, musicgen_model, num_iterations, bpm], outputs=output_audio)
238
 
239
- iface.launch()
 
177
  seed = random.randint(1, 10000)
178
 
179
  # Check if CUDA is available
180
+ if torch.cuda.is_available():
181
+ device = "cuda"
182
+ elif torch.backends.mps.is_available():
183
+ device = "mps"
184
+ else:
185
+ device = "cpu"
186
+ #device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
187
 
188
  # Define the expandable sections
189
  musiclang_blurb = """
 
242
 
243
  generate_button.click(generate_music, inputs=[seed, use_chords, chord_progression, prompt_duration, musicgen_model, num_iterations, bpm], outputs=output_audio)
244
 
245
+ iface.launch()
requirements.txt CHANGED
@@ -1,6 +1,6 @@
1
- torch==2.1.0
2
- torchaudio
3
  audiocraft
4
  musiclang_predict
5
  pyFluidSynth
6
- midi2audio
 
1
+ #torch==2.1.0
2
+ #torchaudio
3
  audiocraft
4
  musiclang_predict
5
  pyFluidSynth
6
+ midi2audio