import streamlit as st import os from PIL import Image from ocr_engine import extract_weight_from_image Install Tesseract runtime in Hugging Face Space os.system("apt update && apt install -y tesseract-ocr") st.set_page_config(page_title="⚖️ Auto Weight Logger", layout="centered") st.title("📷 Auto Weight Logger") st.write("Capture the weight display using your camera or upload an image") Option 1: Capture image from webcam image_file = st.camera_input("Take a photo") Option 2: Upload image from local machine if image_file is None: image_file = st.file_uploader("Or upload an image", type=["jpg", "jpeg", "png"]) if image_file is not None: image = Image.open(image_file) st.image(image, caption="Uploaded Image", use_column_width=True) python Copy Edit with st.spinner("🔍 Extracting weight..."): result = extract_weight_from_image(image) st.success(f"✅ Detected Weight: {result} g")