Hello,
I’ve created an app that uses the st.input_camera to take some pictures. When deploying the app using my private github repository I can’t save the images anywhere. I’m using the PIL module to try to save them but the program doesn’t save them anywhere.
I am trying to create a zip file with all the pictures in it so then I can download them as I found in this article: Download multiple files
Can someone help me with this issue please? I’ll be very happy if I manage to solve it
finished_main = st.button("Finish taking pictures")
# Trying to add the zip file
if finished_main:
zipObj = ZipFile("sample.zip", "w")
num_main = num_main-1
for one_picture in all_pics[num_main]:
with open(one_picture, 'rb') as f:
img_to_zip = f.read()
img_open = Image.open(io.BytesIO(img_to_zip))
st.write(img_open)
zipObj.write(img_open+'.jpg')
#zipObj.write(img_open)
zipObj.close()
ZipfileDotZip = "sample.zip"
with open(ZipfileDotZip, "rb") as f:
bytes = f.read()
b64 = base64.b64encode(bytes).decode()
href = f"<a href=\"data:file/zip;base64,{b64}\" download='{ZipfileDotZip}.zip'>\
Click last model weights\</a>"
st.markdown(href, unsafe_allow_html=True)
# end of trtying