Update src/streamlit_app.py
Browse files- src/streamlit_app.py +6 -3
src/streamlit_app.py
CHANGED
@@ -14,8 +14,8 @@ if "show_camera" not in st.session_state:
|
|
14 |
|
15 |
# π Clear or Retake Button pressed
|
16 |
if st.button("π Clear / Retake Photo"):
|
17 |
-
st.session_state.show_camera = False # hide camera
|
18 |
-
st.
|
19 |
|
20 |
# π Reset camera on next run
|
21 |
if not st.session_state.show_camera:
|
@@ -50,6 +50,9 @@ if img_data:
|
|
50 |
# β Handle low confidence
|
51 |
if not weight or confidence < 80:
|
52 |
st.error(f"β οΈ OCR confidence too low ({int(confidence)}%). Please retake the photo.")
|
|
|
|
|
|
|
53 |
st.stop()
|
54 |
|
55 |
# β
Success
|
@@ -57,7 +60,7 @@ if img_data:
|
|
57 |
|
58 |
# Salesforce URL setup
|
59 |
device_id = "BAL-001"
|
60 |
-
image_url = "" # Optional
|
61 |
|
62 |
encoded_weight = urllib.parse.quote(str(weight))
|
63 |
encoded_device = urllib.parse.quote(device_id)
|
|
|
14 |
|
15 |
# π Clear or Retake Button pressed
|
16 |
if st.button("π Clear / Retake Photo"):
|
17 |
+
st.session_state.show_camera = False # hide camera temporarily
|
18 |
+
st.rerun()
|
19 |
|
20 |
# π Reset camera on next run
|
21 |
if not st.session_state.show_camera:
|
|
|
50 |
# β Handle low confidence
|
51 |
if not weight or confidence < 80:
|
52 |
st.error(f"β οΈ OCR confidence too low ({int(confidence)}%). Please retake the photo.")
|
53 |
+
if st.button("π Retake Photo"):
|
54 |
+
st.session_state.show_camera = False
|
55 |
+
st.rerun()
|
56 |
st.stop()
|
57 |
|
58 |
# β
Success
|
|
|
60 |
|
61 |
# Salesforce URL setup
|
62 |
device_id = "BAL-001"
|
63 |
+
image_url = "" # Optional: add image hosting logic later
|
64 |
|
65 |
encoded_weight = urllib.parse.quote(str(weight))
|
66 |
encoded_device = urllib.parse.quote(device_id)
|