Skip to content

Commit

Permalink
fix: fix PIL dependency (#234)
Browse files Browse the repository at this point in the history
* fix: import PIL inside method

* fix(import): hide rich import

Co-authored-by: Han Xiao <han.xiao@jina.ai>
  • Loading branch information
alaeddine-13 and hanxiao authored Mar 29, 2022
1 parent 2af5af3 commit e332420
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docarray/document/mixins/plot.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from rich import box

from ...helper import deprecate_by


Expand All @@ -11,8 +9,10 @@ def _ipython_display_(self):
self.summary()

def __rich_console__(self, console, options):

yield f":page_facing_up: [b]Document[/b]: [cyan]{self.id}[cyan]"
from rich.table import Table
from rich import box

my_table = Table('Attribute', 'Value', width=80, box=box.ROUNDED)
for f in self.non_empty_fields:
Expand Down
3 changes: 2 additions & 1 deletion docarray/types/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
from typing import TYPE_CHECKING

import numpy as np
from PIL.Image import Image

if TYPE_CHECKING:
from docarray import Document


def image_serializer(inp, attribute_name, doc: 'Document'):
from PIL.Image import Image

if isinstance(inp, str):
doc.uri = inp
doc._metadata['image_type'] = 'uri'
Expand Down

0 comments on commit e332420

Please sign in to comment.