Loading an local static PNG image using Bokeh on the WEBAPPS

sabsbecool
sabsbecool Registered Posts: 3 ✭✭✭✭
edited July 16 in Using Dataiku

Hi,

I am trying to read a static png file from local file system, however unable to see it on the webapp.

Please help.

..

..

div_image = Div(text="""<img src="/home/dataiku/dss/tmp/KNRB_DS/web_apps/xwPBgPO/my_image.png" alt="div_image">""", width=450, height=450)
curdoc().add_root(div_image)

# I am able to save the png file on the following location #/home/dataiku/dss/tmp/ProjectName/web_apps/xwPBgPO/

plt.savefig('my_image.png',bbox_inches='tight') ## Works and my_image.png is created and saved locally on my server.

The above works if the path is an https/http however not from a local file.

Thanks

Sabs

Best Answer

  • fchataigner2
    fchataigner2 Dataiker Posts: 355 Dataiker
    edited July 17 Answer ✓

    Hi,

    you need to save the image into `/home/dataiku/dss/local/static` and access it with an absolute path, like here with a a.png inside local/static

    div_image = Div(text="""<img src="/local/static/a.png" alt="div_image">""", width=450, height=450)
    curdoc().add_root(div_image)

    Regards,

    Frederic

Setup Info
    Tags
      Help me…