Skip to content
This repository has been archived by the owner on May 25, 2024. It is now read-only.

Commit

Permalink
Internal change.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 317682996
  • Loading branch information
pichuan authored and copybara-github committed Jun 22, 2020
1 parent 65b8739 commit 2e2f38c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion nucleus/util/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,10 @@ cc_library(
py_library(
name = "vis",
srcs = ["vis.py"],
deps = ["//nucleus/protos:variants_py_pb2"],
deps = [
"//nucleus/io:gfile",
"//nucleus/protos:variants_py_pb2",
],
)

py_test(
Expand Down
4 changes: 3 additions & 1 deletion nucleus/util/vis.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from __future__ import division
from __future__ import print_function

from nucleus.io import gfile
from IPython import display
import numpy as np
from PIL import Image
Expand Down Expand Up @@ -297,7 +298,8 @@ def save_to_png(arr,
# Saving to a temporary file is needed even when showing in a notebook
if path is None:
path = '/tmp/tmp.png'
img.save(path)
with gfile.Open(path, 'wb') as fout:
img.save(fout, format=path.split('.')[-1])

# Show image (great for notebooks)
if show:
Expand Down

0 comments on commit 2e2f38c

Please sign in to comment.