Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,11 +5,19 @@ import tempfile
|
|
| 5 |
st.title("UV Sterilization Verifier")
|
| 6 |
|
| 7 |
img = st.file_uploader("Upload Post-Sterilization Image", type=["jpg", "png"])
|
| 8 |
-
|
|
|
|
|
|
|
| 9 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".jpg") as f:
|
| 10 |
f.write(img.read())
|
| 11 |
-
f.
|
| 12 |
-
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
|
| 15 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
st.title("UV Sterilization Verifier")
|
| 6 |
|
| 7 |
img = st.file_uploader("Upload Post-Sterilization Image", type=["jpg", "png"])
|
| 8 |
+
|
| 9 |
+
if img is not None:
|
| 10 |
+
# Save uploaded file temporarily
|
| 11 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".jpg") as f:
|
| 12 |
f.write(img.read())
|
| 13 |
+
temp_file_path = f.name
|
| 14 |
+
|
| 15 |
+
# Analyze the image
|
| 16 |
+
coverage, preview_path = analyze_uv_exposure(temp_file_path)
|
| 17 |
|
| 18 |
+
# Display results
|
| 19 |
+
st.image(preview_path, caption=f"Coverage: {coverage}%")
|
| 20 |
+
if coverage >= 95:
|
| 21 |
+
st.success("Compliant")
|
| 22 |
+
else:
|
| 23 |
+
st.error("Fail - Insufficient Exposure")
|