Update src/streamlit_app.py
Browse files- src/streamlit_app.py +3 -3
src/streamlit_app.py
CHANGED
@@ -5,7 +5,7 @@ import uuid
|
|
5 |
import urllib.parse
|
6 |
from datetime import datetime
|
7 |
import pytz
|
8 |
-
from ocr_engine import extract_weight_from_image #
|
9 |
|
10 |
# Set up page
|
11 |
st.set_page_config(page_title="⚖️ Auto Weight Logger", layout="centered")
|
@@ -38,14 +38,14 @@ image = None
|
|
38 |
# Webcam input
|
39 |
if input_mode == "Camera":
|
40 |
cam_photo = st.camera_input("📷 Capture Weight Display", key=st.session_state.camera_key)
|
41 |
-
if cam_photo:
|
42 |
image_bytes = cam_photo.getvalue()
|
43 |
st.session_state.captured_time = get_current_ist_time()
|
44 |
|
45 |
# File upload
|
46 |
elif input_mode == "Upload":
|
47 |
uploaded_file = st.file_uploader("📁 Upload an image (JPG/PNG)", type=["jpg", "jpeg", "png"])
|
48 |
-
if uploaded_file:
|
49 |
image_bytes = uploaded_file.read()
|
50 |
st.session_state.captured_time = get_current_ist_time()
|
51 |
|
|
|
5 |
import urllib.parse
|
6 |
from datetime import datetime
|
7 |
import pytz
|
8 |
+
from ocr_engine import extract_weight_from_image # Ensure this function returns (weight, confidence)
|
9 |
|
10 |
# Set up page
|
11 |
st.set_page_config(page_title="⚖️ Auto Weight Logger", layout="centered")
|
|
|
38 |
# Webcam input
|
39 |
if input_mode == "Camera":
|
40 |
cam_photo = st.camera_input("📷 Capture Weight Display", key=st.session_state.camera_key)
|
41 |
+
if cam_photo is not None:
|
42 |
image_bytes = cam_photo.getvalue()
|
43 |
st.session_state.captured_time = get_current_ist_time()
|
44 |
|
45 |
# File upload
|
46 |
elif input_mode == "Upload":
|
47 |
uploaded_file = st.file_uploader("📁 Upload an image (JPG/PNG)", type=["jpg", "jpeg", "png"])
|
48 |
+
if uploaded_file is not None:
|
49 |
image_bytes = uploaded_file.read()
|
50 |
st.session_state.captured_time = get_current_ist_time()
|
51 |
|