Auto-weight-logger3 / src /streamlit_app.py
Sanjayraju30's picture
Update src/streamlit_app.py
00286f9 verified
raw
history blame
535 Bytes
import streamlit as st
import cv2
import tempfile
from ocr_engine import extract_weight
st.set_page_config(page_title="Auto Weight Logger", layout="centered")
st.title("⚖️ Auto Weight Logger")
img_data = st.camera_input("📷 Capture the weight display")
if img_data:
with tempfile.NamedTemporaryFile(delete=False, suffix=".jpg") as f:
  f.write(img_data.getvalue())
  f.flush()
  weight = extract_weight(f.name)
  st.image(f.name, caption="📸 Snapshot")
  st.success(f"✅ Detected Weight: {weight} g")