Auto-weight-logger2 / src /streamlit_app.py
Sanjayraju30's picture
Update src/streamlit_app.py
334cd1a verified
raw
history blame
957 Bytes
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