Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
I'm using Streamlit to create a web app and I want to load a png image from a managed folder into my app (without using PIL module)
Does anyone have an idea about how to do it ?
If the goal is to display an image located in the managed folder in the streamlit webapp, then you can use Dataiku Managed Folders API and BytesIO. Please refer to the example below:
import streamlit as st import pandas as pd import numpy as np import altair as alt import dataiku import io st.title('Hello Streamlit!') folder_handle = dataiku.Folder("OZG8yjfI") # replace ID with your managed folder myfile = "dataiku-logo.jpeg" # replace with your file name and path in folder with folder_handle.get_download_stream(myfile) as io_stream: img = io.BytesIO(io_stream.data) st.image(img, channels="RGB")
but it is similar to using the PIL.
from PIL import Image with folder_handle.get_download_stream(myfile) as io_stream: image = Image.open(io_stream) st.image(image, channels="RGB")
You still need some library to read from the "download_stream", so I'm not sure I fully understood the issue and the goal.
If the above is not what you were looking for, please provide more details on what is the issue and what is the goal.