pachet commited on
Commit
9132b25
·
1 Parent(s): 678c870

Update app.py

Browse files
Files changed (2) hide show
  1. app.py +9 -4
  2. essai.py +0 -0
app.py CHANGED
@@ -11,23 +11,28 @@ def get_verovio_resource_path():
11
 
12
  def render_mei(mei_path):
13
  tk = verovio.toolkit()
14
-
15
  # Set resource path explicitly
16
  resource_path = get_verovio_resource_path()
 
17
  print("[Debug] Using resource path:", resource_path)
18
  if resource_path:
19
  try:
20
  tk.setResourcePath(resource_path)
21
- # tk.setOptions({ "resourcePath": resource_path })
22
  except Exception as e:
23
  print("[Error] Failed to set resourcePath:", e)
24
-
 
 
25
  with open(mei_path, "r", encoding="utf-8") as f:
26
  mei_data = f.read()
 
 
 
27
 
28
  try:
29
  tk.loadData(mei_data)
30
- return tk.renderToSVG(1)
 
31
  except Exception as e:
32
  return f"<pre>Rendering failed:\n{e}</pre>"
33
 
 
11
 
12
  def render_mei(mei_path):
13
  tk = verovio.toolkit()
 
14
  # Set resource path explicitly
15
  resource_path = get_verovio_resource_path()
16
+ print(f"resource path: {os.listdir(resource_path)}")
17
  print("[Debug] Using resource path:", resource_path)
18
  if resource_path:
19
  try:
20
  tk.setResourcePath(resource_path)
 
21
  except Exception as e:
22
  print("[Error] Failed to set resourcePath:", e)
23
+ # tk.setOptions({
24
+ # "font": "/app/data/Bravura", # Path to the font folder
25
+ # })
26
  with open(mei_path, "r", encoding="utf-8") as f:
27
  mei_data = f.read()
28
+ # tk.loadFile("path-to-mei-file")
29
+ # return tk.renderToSVG(1)
30
+ print(verovio.__path__)
31
 
32
  try:
33
  tk.loadData(mei_data)
34
+ res = tk.renderToSVG(1)
35
+ return res
36
  except Exception as e:
37
  return f"<pre>Rendering failed:\n{e}</pre>"
38
 
essai.py ADDED
File without changes