juancopi81 commited on
Commit
d58023a
1 Parent(s): 4edff9e

Add musescoreDirectPNGPath

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -1,15 +1,13 @@
1
  import os
2
 
3
  os.system("python3 -m pip install -e .")
4
- os.system("whereis musescore3")
5
- os.system("whereis musescore")
6
 
7
  import gradio as gr
8
 
9
  import note_seq
10
  from pytube import YouTube
11
  from pydub import AudioSegment
12
- from music21 import converter
13
 
14
  from inferencemodel import InferenceModel
15
  from utils import upload_audio, create_image_from_note_sequence
@@ -20,6 +18,12 @@ nest_asyncio.apply()
20
  SAMPLE_RATE = 16000
21
  SF2_PATH = "SGM-v2.01-Sal-Guit-Bass-V1.3.sf2"
22
 
 
 
 
 
 
 
23
  # Start inference model
24
  inference_model = InferenceModel("/home/user/app/checkpoints/mt3/", "mt3")
25
  current_model = "mt3"
 
1
  import os
2
 
3
  os.system("python3 -m pip install -e .")
 
 
4
 
5
  import gradio as gr
6
 
7
  import note_seq
8
  from pytube import YouTube
9
  from pydub import AudioSegment
10
+ from music21 import converter, environment
11
 
12
  from inferencemodel import InferenceModel
13
  from utils import upload_audio, create_image_from_note_sequence
 
18
  SAMPLE_RATE = 16000
19
  SF2_PATH = "SGM-v2.01-Sal-Guit-Bass-V1.3.sf2"
20
 
21
+ # Set up music21 with musescore
22
+ us = environment.UserSettings()
23
+ us["musescoreDirectPNGPath"] = "/usr/bin/mscore3"
24
+ os.putenv("QT_QPA_PLATFORM", "offscreen")
25
+ os.putenv("XDG_RUNTIME_DIR", environment.Environment().getRootTempDir())
26
+
27
  # Start inference model
28
  inference_model = InferenceModel("/home/user/app/checkpoints/mt3/", "mt3")
29
  current_model = "mt3"