Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -98,19 +98,23 @@ if input_choice == "📤 Upload Image":
|
|
| 98 |
else:
|
| 99 |
st.warning(label)
|
| 100 |
|
|
|
|
|
|
|
| 101 |
elif input_choice == "📷 Use Webcam":
|
| 102 |
-
|
|
|
|
|
|
|
| 103 |
if camera_image:
|
| 104 |
image_input = resize_image(Image.open(camera_image))
|
| 105 |
-
st.image(image_input, caption="Webcam Snapshot", use_container_width=True)
|
| 106 |
|
| 107 |
with st.spinner("Analyzing..."):
|
| 108 |
result_img, confidence, label = detect_and_predict(image_input)
|
| 109 |
|
| 110 |
-
col1, col2 = st.columns(2)
|
| 111 |
-
with col1:
|
| 112 |
-
st.image(result_img, caption="Detection Output", use_container_width=True)
|
| 113 |
with col2:
|
|
|
|
|
|
|
| 114 |
if confidence is not None:
|
| 115 |
st.metric("Confidence Score", f"{confidence*100:.2f}%")
|
| 116 |
if "Mask" in label:
|
|
|
|
| 98 |
else:
|
| 99 |
st.warning(label)
|
| 100 |
|
| 101 |
+
|
| 102 |
+
|
| 103 |
elif input_choice == "📷 Use Webcam":
|
| 104 |
+
col1, col2 = st.columns([1, 3])
|
| 105 |
+
with col1:
|
| 106 |
+
camera_image = st.camera_input("Take a picture using webcam")
|
| 107 |
if camera_image:
|
| 108 |
image_input = resize_image(Image.open(camera_image))
|
| 109 |
+
# st.image(image_input, caption="Webcam Snapshot", use_container_width=True)
|
| 110 |
|
| 111 |
with st.spinner("Analyzing..."):
|
| 112 |
result_img, confidence, label = detect_and_predict(image_input)
|
| 113 |
|
| 114 |
+
# col1, col2 = st.columns(2)
|
|
|
|
|
|
|
| 115 |
with col2:
|
| 116 |
+
st.image(result_img, caption="Detection Output", use_container_width=True)
|
| 117 |
+
# with col2:
|
| 118 |
if confidence is not None:
|
| 119 |
st.metric("Confidence Score", f"{confidence*100:.2f}%")
|
| 120 |
if "Mask" in label:
|