Submit your innovative use case or inspiring success story to the 2023 Dataiku Frontrunner Awards! LET'S GO

Loading an local static PNG image using Bokeh on the WEBAPPS

Solved!
sabsbecool
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 Solution
fchataigner2
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

View solution in original post

1 Reply
fchataigner2
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

?
Labels (2)
A banner prompting to get Dataiku