Skip to content

feat: allow choose to display from tensor or from uri in document#518

Merged
samsja merged 3 commits into
mainfrom
refactor-allow-display-from-diff-source
Sep 5, 2022
Merged

feat: allow choose to display from tensor or from uri in document#518
samsja merged 3 commits into
mainfrom
refactor-allow-display-from-diff-source

Conversation

@samsja

@samsja samsja commented Sep 1, 2022

Copy link
Copy Markdown
Member

context

This pr refactor the code so that we can chose if we want to display from uri or from tensor ( issue #517)

Now you can do

from docarray import Document

d = Document(uri=os.path.join(cur_dir, 'toydata/test.png'))
d.display()
d.display(from_='uri')

d.load_uri_to_image_tensor()
d.uri = None

d.display()
d.display(from_='tensor')

@codecov

codecov Bot commented Sep 1, 2022

Copy link
Copy Markdown

Codecov Report

Merging #518 (628851b) into main (b268f6f) will increase coverage by 2.16%.
The diff coverage is 83.78%.

@@            Coverage Diff             @@
##             main     #518      +/-   ##
==========================================
+ Coverage   84.05%   86.22%   +2.16%     
==========================================
  Files         142      142              
  Lines        7013     7028      +15     
==========================================
+ Hits         5895     6060     +165     
+ Misses       1118      968     -150     
Flag Coverage Δ
docarray 86.22% <83.78%> (+2.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
docarray/document/mixins/plot.py 78.91% <83.78%> (+1.43%) ⬆️
docarray/array/mixins/traverse.py 95.04% <0.00%> (+4.13%) ⬆️
docarray/document/mixins/sugar.py 68.00% <0.00%> (+12.00%) ⬆️
docarray/helper.py 81.90% <0.00%> (+13.12%) ⬆️
docarray/array/mixins/group.py 87.17% <0.00%> (+17.94%) ⬆️
docarray/array/mixins/post.py 93.02% <0.00%> (+74.41%) ⬆️
docarray/array/mixins/embed.py 89.47% <0.00%> (+78.94%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@samsja samsja changed the title refactor: create display from tensor and from uri feat: allow choose to display from tensor or from uri in document Sep 1, 2022
Comment thread docarray/document/mixins/plot.py
@samsja samsja linked an issue Sep 5, 2022 that may be closed by this pull request
@samsja samsja force-pushed the refactor-allow-display-from-diff-source branch from b91183c to 29faee3 Compare September 5, 2022 08:29
Comment thread docarray/document/mixins/plot.py
Comment thread docarray/document/mixins/plot.py
Comment thread docarray/document/mixins/plot.py
Comment thread docarray/document/mixins/plot.py
Comment thread docarray/document/mixins/plot.py
@samsja samsja merged commit fa05ec3 into main Sep 5, 2022
@samsja samsja deleted the refactor-allow-display-from-diff-source branch September 5, 2022 16:00
@alexcg1

alexcg1 commented Sep 9, 2022

Copy link
Copy Markdown
Contributor

How come it's from_ and not from?

@JohannesMessner

Copy link
Copy Markdown
Member

from is a Python keyword and cannot be used

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't display image with blob PIL

4 participants