Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +10 -8
src/streamlit_app.py
CHANGED
|
@@ -4,13 +4,15 @@ import tempfile
|
|
| 4 |
import base64
|
| 5 |
from ocr_engine import extract_weight
|
| 6 |
|
| 7 |
-
st.
|
| 8 |
-
|
|
|
|
|
|
|
| 9 |
|
| 10 |
if img_data:
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
|
|
|
| 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")
|