Auto-weight-logger2 / src /streamlit_app.py
Sanjayraju30's picture
Update src/streamlit_app.py
216f81d verified
raw
history blame
464 Bytes
import streamlit as st
import cv2
import tempfile
import base64
from ocr_engine import extract_weight
st.title("Auto Weight Logger")
img_data = st.camera_input("Capture 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")