首页 > 解决方案 > 在 Google Cloud AI Notebook 中使用 Bokeh Server

问题描述

我正在尝试在 Google Cloud AI 笔记本环境中构建和测试一些散景组件。我已经使用这个云实例几个月了,几乎没有问题,但我似乎无法让教程https://docs.bokeh.org/en/latest/docs/user_guide/notebook.html正常工作。有没有人在这种环境中成功使用散景服务器?

该教程似乎不适用于我的用例。遵循和调整此方法时会返回几个 JavaScript 错误。

handler = FunctionHandler(modify_doc)
app = Application(handler)
show(modify_doc, notebook_url=remote_jupyter_proxy_url)

def remote_jupyter_proxy_url(port):
    """
    Callable to configure Bokeh's show method when a proxy must be
    configured.

    If port is None we're asking about the URL
    for the origin header.
    """
    base_url = URL OF AI NOTEBOOK
    host = urllib.parse.urlparse(base_url).netloc

    # If port is None we're asking for the URL origin
    # so return the public hostname.
    if port is None:
        return host

    service_url_path = NOT A JUPYTER HUB SO UNCLEAR WHAT SHOULD BE HERE
    proxy_url_path = 'proxy/%d' % port

    user_url = urllib.parse.urljoin(base_url, service_url_path)
    full_url = urllib.parse.urljoin(user_url, proxy_url_path)
    print(full_url)
    return full_url

将前面的代码拼凑在一起时,我在检查笔记本时收到以下消息:

panellayout.js:213 混合内容:“URL”处的页面是通过 HTTPS 加载的,但请求了不安全的脚本“URL”。此请求已被阻止;内容必须通过 HTTPS 提供。

标签: google-cloud-platformjupyter-notebookbokehjupyter-lab

解决方案


推荐阅读