Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Hi all,
I have an image file placed under the static web resources in Dataiku.
How do we specify the path for this image so that I can use this image in my Dash app?
Note: I am using an online instance of Dataiku and not on my local server.
Operating system used: Windows
Hi @Usersyed ,
Global Shared Code is not available on Dataiku Online instances at this time. So you will not be able to use static resources. You should instead use a Managed folder where you store the images and read from that folder.
import plotly.express as px
import dataiku
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import plotly.graph_objects as go
import dash
import base64
#replace images with the actual folder name
folder = dataiku.Folder("images")
with folder.get_download_stream("subfolder/test.png") as stream:
encoded_image = base64.b64encode(stream.read())
#print(encoded_image)
app.layout = html.Div([
html.Img(src='data:image/png;base64,{}'.format(encoded_image.decode()))
])
@AlexT Thank you for this solution.
I will test this one also.
I tried using "/local/static/image_name" as the file path and it worked.