Update app.py
Browse files
app.py
CHANGED
@@ -962,7 +962,11 @@ with tabs[1]:
|
|
962 |
cam1_img = st.camera_input("Take a picture - Cam 1", key="main_cam1")
|
963 |
if cam1_img:
|
964 |
filename = generate_filename("cam1_snap")
|
965 |
-
if st.session_state.get('cam1_file') and os.path.exists(st.session_state['cam1_file']):
|
|
|
|
|
|
|
|
|
966 |
try:
|
967 |
with open(filename, "wb") as f: f.write(cam1_img.getvalue())
|
968 |
st.session_state['cam1_file'] = filename; st.session_state['history'].append(f"Snapshot from Cam 1: {filename}"); st.image(Image.open(filename), caption="Camera 1 Snap", use_container_width=True); logger.info(f"Saved snapshot from Camera 1: {filename}"); st.success(f"Saved {filename}")
|
|
|
962 |
cam1_img = st.camera_input("Take a picture - Cam 1", key="main_cam1")
|
963 |
if cam1_img:
|
964 |
filename = generate_filename("cam1_snap")
|
965 |
+
if st.session_state.get('cam1_file') and os.path.exists(st.session_state['cam1_file']):
|
966 |
+
try:
|
967 |
+
os.remove(st.session_state['cam1_file'])
|
968 |
+
except OSError:
|
969 |
+
pass
|
970 |
try:
|
971 |
with open(filename, "wb") as f: f.write(cam1_img.getvalue())
|
972 |
st.session_state['cam1_file'] = filename; st.session_state['history'].append(f"Snapshot from Cam 1: {filename}"); st.image(Image.open(filename), caption="Camera 1 Snap", use_container_width=True); logger.info(f"Saved snapshot from Camera 1: {filename}"); st.success(f"Saved {filename}")
|