ktrk115 commited on
Commit
7a654e0
·
verified ·
1 Parent(s): f46e28b

Update processing_markupdm.py

Browse files
Files changed (1) hide show
  1. processing_markupdm.py +2 -3
processing_markupdm.py CHANGED
@@ -9,9 +9,8 @@ from pathlib import Path
9
 
10
  import numpy as np
11
  import torch
12
- from cr_renderer.fonts import FontManager
13
  from PIL import Image, ImageDraw
14
- from svg import Style as SVGStyle
15
  from transformers import (
16
  ImageProcessingMixin,
17
  PreTrainedModel,
@@ -430,7 +429,7 @@ class MarkupDMProcessor(ProcessorMixin): # type: ignore
430
  matched = re.search("<svg[^>]*>", svg)
431
  assert matched is not None, "SVG tag not found"
432
  i = matched.span()[1]
433
- style = SVGStyle(text=style_text)
434
  example["svg"] = svg[:i] + style.as_str() + svg[i:]
435
 
436
  def render(self, example: dict, save_dir: str | Path | None = None) -> Image.Image:
 
9
 
10
  import numpy as np
11
  import torch
12
+ from .fonts import FontManager
13
  from PIL import Image, ImageDraw
 
14
  from transformers import (
15
  ImageProcessingMixin,
16
  PreTrainedModel,
 
429
  matched = re.search("<svg[^>]*>", svg)
430
  assert matched is not None, "SVG tag not found"
431
  i = matched.span()[1]
432
+ style = f"<style>{style_text}</style>"
433
  example["svg"] = svg[:i] + style.as_str() + svg[i:]
434
 
435
  def render(self, example: dict, save_dir: str | Path | None = None) -> Image.Image: