Spaces:
Sleeping
Sleeping
Yongkang ZOU
commited on
Commit
·
c120688
1
Parent(s):
54dde8b
update musicxml viz
Browse files
app.py
CHANGED
|
@@ -67,7 +67,11 @@ def render_musicxml_via_verovio_api(musicxml_path: Path) -> str:
|
|
| 67 |
try:
|
| 68 |
svg = response.json()["svg"]
|
| 69 |
svg_b64 = base64.b64encode(svg.encode("utf-8")).decode("utf-8")
|
| 70 |
-
html = f'
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
return html
|
| 72 |
except Exception as e:
|
| 73 |
return f"⚠️ SVG 解析失败:{e}"
|
|
|
|
| 67 |
try:
|
| 68 |
svg = response.json()["svg"]
|
| 69 |
svg_b64 = base64.b64encode(svg.encode("utf-8")).decode("utf-8")
|
| 70 |
+
html = f'''
|
| 71 |
+
<div style="background-color: white; padding: 10px; border-radius: 8px;">
|
| 72 |
+
<img src="data:image/svg+xml;base64,{svg_b64}" style="width:100%; max-height:600px;" />
|
| 73 |
+
</div>
|
| 74 |
+
'''
|
| 75 |
return html
|
| 76 |
except Exception as e:
|
| 77 |
return f"⚠️ SVG 解析失败:{e}"
|