gpt4 book ai didi

javascript - 在 Google Colab Notebook 中提供 Iframe : localhost refused to connect

转载 作者:行者123 更新时间:2023-11-28 03:21:48 25 4
gpt4 key购买 nike

我正在尝试使用以下内容从 Google Colab 笔记本提供一些 HTML:

from IPython.display import IFrame

IFrame(src='./output/index.html', width=700, height=600)

但是,这会抛出localhost拒绝连接:

enter image description here

有谁知道我如何在Colab笔记本内的index.html(必须加载javascript)中提供html?任何指示将不胜感激!

最佳答案

您可以从映射到 /usr/local/share/jupyter/nbextensions 的路径 /nbextensions/ 提供内容。

因此您可以将内容放在那里。

!ln -s /usr/local/share/jupyter/nbextensions /nbextensions
%cd /nbextensions
!wget -q https://upload.wikimedia.org/wikipedia/commons/3/37/Youtube.svg

然后提供图像

%%html
<img src=/nbextensions/Youtube.svg>

我想,我无法让它与 IFrame 一起工作。我不知道为什么。

这是一个示例 colab notebook .

关于javascript - 在 Google Colab Notebook 中提供 Iframe : localhost refused to connect,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59091645/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com