Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -302,6 +302,7 @@ def real_time_detection_page():
|
|
| 302 |
classification_text = st.empty()
|
| 303 |
classification_progress = st.empty()
|
| 304 |
detection_info = st.empty()
|
|
|
|
| 305 |
table = st.empty()
|
| 306 |
image_display = st.empty()
|
| 307 |
audio = st.empty()
|
|
@@ -338,6 +339,7 @@ def real_time_detection_page():
|
|
| 338 |
classification.progress(33)
|
| 339 |
|
| 340 |
if smoking_count > 2:
|
|
|
|
| 341 |
gender_results = [classify_gender(img) for img in snapshots]
|
| 342 |
classification.progress(66)
|
| 343 |
age_results = [classify_age(img) for img in snapshots]
|
|
@@ -382,7 +384,7 @@ def real_time_detection_page():
|
|
| 382 |
else:
|
| 383 |
st.error(f"Audio file not found: {audio_key}.wav")
|
| 384 |
else:
|
| 385 |
-
|
| 386 |
image_display.empty()
|
| 387 |
audio.empty()
|
| 388 |
classification_text.text("Classification Progress: Completed!")
|
|
@@ -405,6 +407,7 @@ def real_time_detection_page():
|
|
| 405 |
classification_progress.empty()
|
| 406 |
classification_text.empty()
|
| 407 |
capture_text.empty()
|
|
|
|
| 408 |
detection_info.info("Starting detection...")
|
| 409 |
ctx.video_transformer.snapshots = []
|
| 410 |
ctx.video_transformer.last_capture_time = time.time()
|
|
|
|
| 302 |
classification_text = st.empty()
|
| 303 |
classification_progress = st.empty()
|
| 304 |
detection_info = st.empty()
|
| 305 |
+
status_alert = st.empty() # New placeholder for status alert
|
| 306 |
table = st.empty()
|
| 307 |
image_display = st.empty()
|
| 308 |
audio = st.empty()
|
|
|
|
| 339 |
classification.progress(33)
|
| 340 |
|
| 341 |
if smoking_count > 2:
|
| 342 |
+
status_alert.error("Smoking Detected!") # Red alert for smoking
|
| 343 |
gender_results = [classify_gender(img) for img in snapshots]
|
| 344 |
classification.progress(66)
|
| 345 |
age_results = [classify_age(img) for img in snapshots]
|
|
|
|
| 384 |
else:
|
| 385 |
st.error(f"Audio file not found: {audio_key}.wav")
|
| 386 |
else:
|
| 387 |
+
status_alert.success("No Smoking Detected") # Green alert for no smoking
|
| 388 |
image_display.empty()
|
| 389 |
audio.empty()
|
| 390 |
classification_text.text("Classification Progress: Completed!")
|
|
|
|
| 407 |
classification_progress.empty()
|
| 408 |
classification_text.empty()
|
| 409 |
capture_text.empty()
|
| 410 |
+
status_alert.empty() # Clear the alert for the next cycle
|
| 411 |
detection_info.info("Starting detection...")
|
| 412 |
ctx.video_transformer.snapshots = []
|
| 413 |
ctx.video_transformer.last_capture_time = time.time()
|