Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- 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")
|