Sanjayraju30 commited on
Commit
e789af9
Β·
verified Β·
1 Parent(s): 09d2cb1

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. 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 for one cycle
18
- st.experimental_rerun() # or st.rerun() depending on streamlit version
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)