Sanjayraju30 commited on
Commit
1f1d6d4
Β·
verified Β·
1 Parent(s): fa29632

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +1 -9
src/streamlit_app.py CHANGED
@@ -8,13 +8,9 @@ st.title("βš–οΈ Auto Weight Logger")
8
 
9
  img_data = st.camera_input("πŸ“· Capture the weight display")
10
 
11
- # βœ… Add a confirmation the photo was captured
12
- st.write("πŸ“Έ Waiting for image capture...")
13
-
14
  if img_data:
15
- st.write("βœ… Image captured successfully")
16
 
17
- # βœ… Check file size
18
  if len(img_data.getvalue()) > 5 * 1024 * 1024:
19
  st.error("❌ Image too large (>5MB). Please try again.")
20
  st.stop()
@@ -25,20 +21,16 @@ if img_data:
25
  with st.spinner("πŸ” Extracting weight..."):
26
  weight, confidence = extract_weight_from_image(image)
27
 
28
- # βœ… DEBUG display
29
  st.write(f"πŸ› οΈ DEBUG: weight = {weight}, confidence = {confidence}")
30
 
31
- # βœ… Retry logic
32
  if not weight or confidence < 80:
33
  st.error(f"⚠️ OCR confidence too low ({int(confidence)}%). Please retake the image.")
34
  if st.button("πŸ” Try Again"):
35
  st.experimental_rerun()
36
  st.stop()
37
 
38
- # βœ… Show result
39
  st.success(f"βœ… Detected Weight: {weight} g (Confidence: {int(confidence)}%)")
40
 
41
- # βœ… Salesforce integration
42
  device_id = "BAL-001"
43
  image_url = ""
44
 
 
8
 
9
  img_data = st.camera_input("πŸ“· Capture the weight display")
10
 
 
 
 
11
  if img_data:
12
+ st.success("βœ… Image captured successfully!")
13
 
 
14
  if len(img_data.getvalue()) > 5 * 1024 * 1024:
15
  st.error("❌ Image too large (>5MB). Please try again.")
16
  st.stop()
 
21
  with st.spinner("πŸ” Extracting weight..."):
22
  weight, confidence = extract_weight_from_image(image)
23
 
 
24
  st.write(f"πŸ› οΈ DEBUG: weight = {weight}, confidence = {confidence}")
25
 
 
26
  if not weight or confidence < 80:
27
  st.error(f"⚠️ OCR confidence too low ({int(confidence)}%). Please retake the image.")
28
  if st.button("πŸ” Try Again"):
29
  st.experimental_rerun()
30
  st.stop()
31
 
 
32
  st.success(f"βœ… Detected Weight: {weight} g (Confidence: {int(confidence)}%)")
33
 
 
34
  device_id = "BAL-001"
35
  image_url = ""
36