Sanjayraju30 commited on
Commit
00286f9
Β·
verified Β·
1 Parent(s): ad52bbe

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +7 -8
src/streamlit_app.py CHANGED
@@ -1,18 +1,17 @@
1
  import streamlit as st
2
  import cv2
3
  import tempfile
4
- import base64
5
  from ocr_engine import extract_weight
6
 
7
  st.set_page_config(page_title="Auto Weight Logger", layout="centered")
8
  st.title("βš–οΈ Auto Weight Logger")
9
 
10
- img_data = st.camera_input("πŸ“· Capture weight display")
11
 
12
  if img_data:
13
- with tempfile.NamedTemporaryFile(delete=False, suffix=".jpg") as f:
14
- f.write(img_data.getvalue())
15
- f.flush()
16
- weight = extract_weight(f.name)
17
- st.image(f.name, caption="πŸ“Έ Snapshot")
18
- st.success(f"βœ… Detected Weight: {weight} g")
 
1
  import streamlit as st
2
  import cv2
3
  import tempfile
 
4
  from ocr_engine import extract_weight
5
 
6
  st.set_page_config(page_title="Auto Weight Logger", layout="centered")
7
  st.title("βš–οΈ Auto Weight Logger")
8
 
9
+ img_data = st.camera_input("πŸ“· Capture the weight display")
10
 
11
  if img_data:
12
+  with tempfile.NamedTemporaryFile(delete=False, suffix=".jpg") as f:
13
+   f.write(img_data.getvalue())
14
+   f.flush()
15
+   weight = extract_weight(f.name)
16
+   st.image(f.name, caption="πŸ“Έ Snapshot")
17
+   st.success(f"βœ… Detected Weight: {weight} g")