Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +7 -9
src/streamlit_app.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
-
import
|
3 |
-
import
|
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")
|
@@ -9,9 +8,8 @@ st.title("βοΈ Auto Weight Logger")
|
|
9 |
img_data = st.camera_input("π· Capture the weight display")
|
10 |
|
11 |
if img_data:
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
st.success(f"β
Detected Weight: " + str(weight) + " g")
|
|
|
1 |
import streamlit as st
|
2 |
+
from PIL import Image
|
3 |
+
from ocr_engine import extract_weight_from_image
|
|
|
4 |
|
5 |
st.set_page_config(page_title="Auto Weight Logger", layout="centered")
|
6 |
st.title("βοΈ Auto Weight Logger")
|
|
|
8 |
img_data = st.camera_input("π· Capture the weight display")
|
9 |
|
10 |
if img_data:
|
11 |
+
image = Image.open(img_data)
|
12 |
+
st.image(image, caption="πΈ Snapshot", use_column_width=True)
|
13 |
+
with st.spinner("Extracting weight..."):
|
14 |
+
weight = extract_weight_from_image(image)
|
15 |
+
st.success(f"β
Detected Weight: {weight} g")
|
|