本文介绍了将图像添加到通过私有仓库中的github可以查看的jupyter笔记本中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现,当存储库是私有的时,通过简单的例如![](img/myimage.png)嵌入到jupyter标记中的图像没有显示在github笔记本查看器中.

I found that images embedded in jupyter markups by a simple eg ![](img/myimage.png) didnt display in the github notebook viewer, when the repository is private.

我尝试了一堆黑客攻击.

I tried a bunch of hacking around.

显然在4.x.x中具有将图像作为base64元数据嵌入的功能?但是我无法在自己的笔记本电脑上看到它.

Apparently there is functionality in 4.x.x to embed images as base64 metadata? But I couldnt see that in my own notebook.

推荐答案

最后,对我有用的方法很简单,创建一个看起来像这样的代码单元:

Finally, what worked for me, very simply, create a code cell that looks like:

from IPython.display import Image, display
display(Image(filename='img/myimage.png', embed=True))

这样做:

  • 将本地图像img/myimage.png加载到笔记本中
  • 将其嵌入到笔记本中(可能是base64),以便可以通过github笔记本查看器进行查看,而不会出现任何问题
  • didnt涉及在code部分本身中嵌入400行base64:-)
  • loaded the local image img/myimage.png, into the notebook
  • embedded it in the notebook (probably as base64), so that it could be viewed via the github notebook viewer, with no issues
  • didnt involve embedded 400 lines of base64 into the code section itself :-)

这篇关于将图像添加到通过私有仓库中的github可以查看的jupyter笔记本中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 13:20