Community Conundrum 25:Feature Visualization is now live! Read More

Loading an local static PNG image using Bokeh on the WEBAPPS

Level 1
Loading an local static PNG image using Bokeh on the WEBAPPS

Hi,

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

Please help.

..

..

 

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

 

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

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)

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

 Thanks

Sabs

0 Kudos
1 Reply
Dataiker
Dataiker

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

Labels (2)