Closed da-tubi closed 2 years ago
we should not need to use
box2d_demo.to_image().to_pil()
to display an image.
text_demo = image | Box2d(118, 18, 520, 136) | Text("Mojito", (118, 8))
text_demo.to_image().to_pil()
change to
image | Box2d(118, 18, 520, 136) | Text("Mojito", (118, 8))
text_demo.to_image().to_pil()
is used to make github preview work.
isnt this a bug?
Otherwise, it gives user an impression that we have to make to_image().to_pil()
to make the notebook work.
For example, image
itself can work well, can we just make the rendered visualized image work the same?
isnt this a bug?
It is a github ipynb render bug.
Otherwise, it gives user an impression that we have to make to_image().to_pil() to make the notebook work.
Let me add comments in the notebook.
For example, image itself can work well, can we just make the rendered visualized image work the same?
The current impl is ok. It is a github bug. Github only support previewing an old version of ipynb.
comment added:
I guess what I meant is that, for example, in the github preview notebook, Cell [1] works directly from rikai.types.Image
, right?
Can we make
box2d_demo = image | Box2d(118, 18, 520, 136)
where box2d_demo share the same impl as rikai.types.Image
when the display is called?
We can not make box2d_demo
(rikai ImageDraw) or box2d_demo.to_image()
(rikai Image) work in Github Preview now.
Cell [1] works because it is an external image. xyz_demo
is embedded image. For embedded images, the current impl is a work around for Databricks notebook. See #434
If we make it work for Github Preview, it may break Databricks notebook.
My first attempt (the third commit of this pr), try xyz_demo.to_image()
:
i dont think this is an inline vs embedded problem. For example, after to_pil()
, that is an in memory PIL image as well. Can we understand what protocol makes PIL works , and implement the same for ImageDraw
?
Thats why pil works and image/draw do not work:
It works in Google colab. It is a Github Preview issue.
For example, can we make Image
or ImageDraw
's display()
returns a PIL image instead?
Finally done here: https://github.com/liga-ai/ligavision/pull/6
github preview: https://github.com/da-tubi/rikai/blob/feature/mojito_dsl/notebooks/MojitoDSL.ipynb google colab: https://colab.research.google.com/github/da-tubi/rikai/blob/feature/mojito_dsl/notebooks/MojitoDSL.ipynb