Upload image to drive from numpy.ndarray

I use opencv in my projects and i would like to upload the image when i press a button.
So, i have a video stream with a webcamera and i would like to save and upload an image when i click a button.
How can i do this?
First im trying to upload an image but it doesnt work. My plan the filename will be the current date.
im trying to use "photos.put(name, f) where the name is the current date and the f is “.jpg” but the terminal write "numpy.ndarray object has no attribute filename.

Hi @Laszlo_Sebestyen, welcome to the Streamlit community!

Can you post a full code sample of what you’ve tried? In general, once you have the bytes data, you would add code to write the bytes to a file:


Hi @randyzwitch , thanks. Here is the code:

deta = Deta(DETA_KEY)
photos = deta.Drive(“Photos”)

def upload_img(file_name):
return photos.put(file_name)

test = st.button(“Save”)

if test:

Where the gray is an numpy array which i can show in the streamlit platform if i use st.image(gray)