Can not get st.camera_input() to fully work

Hi all,

I have been playing around with the st.camer_input function and I can not seem to get it to work. It takes an image when I tell it to but then does nothing else. The code I am using is below:

import streamlit as st

image1 = st.camera_input(“Camera”)
if image1:
st.image(image1)

All I want it to do is to take an image and then display it on the screen.
Is anyone able to help?

Your code works as expected for me.

Ok, thank you.
Could there be a problem with my computer?
Would it help if I attach a picture?

What happens if you deploy that code to streamlit cloud?

As a side note, you want to check for non-noneness, not truthyness:

if image1 is not None:
   ...

It is probably the same in this case, but better safe than sorry.

Hi, sorry for the late reply. I did try on the cloud and it worked perfectly so I think there might be something wrong with my computer.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.