File size: 957 Bytes
fb1a823 c41b38b fb1a823 334cd1a d54c470 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
import streamlit as st
from PIL import Image
st.title("📸 Auto Weight Logger with Retake Option")
# Session state to track if image is captured
if 'captured' not in st.session_state:
st.session_state.captured = False
if 'image' not in st.session_state:
st.session_state.image = None
# Function to reset camera
def retake():
st.session_state.captured = False
st.session_state.image = None
# Only show camera if image is not captured
if not st.session_state.captured:
image = st.camera_input("Take a picture")
if image:
st.session_state.image = image
st.session_state.captured = True
# If image is captured, show options
if st.session_state.captured and st.session_state.image:
st.image(st.session_state.image, caption="Captured Image", use_column_width=True)
st.button("Retake", on_click=retake)
st.success("✅ Image captured successfully.")
# You can add OCR or Salesforce upload button here
|