Closed dtaniwaki closed 5 years ago
What is your expected bahavior? just return svg
text without wrapping SVG
method?
How about adding one kwarg use_ipython=False
option in this method and when false just return svg text.
I think we should let a caller convert the output, so just returning the output of drawer.GetDrawingText()
is fine, then the caller can handle it as they want.
e.g.
svg = visualizer.visualize()
# For a Jupyter user
from IPython.core.display import SVG
SVG(svg.replace('svg:', ''))
# For a user who want to save a file as png
import cairosvg
cairosvg.svg2png(bytestring=svg, write_to="foo.png")
With this interface, you can save it even as JPEG with no problem.
Moreover, we can remove unexpected None
return value which is hard to debug the error detail for inference and automation cases.
https://github.com/pfnet-research/chainer-chemistry/pull/388
How about this?
Closed by #388
I'm using Chainer Chemistry for inference API server and want to get svg data directly from the
visualize
method. However,visualize
method call withoutsave_filepath
requiresIPython
which is completely unnecessary for my case. https://github.com/pfnet-research/chainer-chemistry/blob/adf740a35dca28ba9602214d070c2422b8ce3c6f/chainer_chemistry/saliency/visualizer/mol_visualizer.py#L129-L131Could you consider removing IPython dependency from this method?