Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -97,7 +97,7 @@ elif input_option == "Upload Video":
|
|
| 97 |
|
| 98 |
# Create a placeholder for video frame processing
|
| 99 |
video_frame_placeholder = st.empty()
|
| 100 |
-
fire_detected =
|
| 101 |
|
| 102 |
# Loop through video frames
|
| 103 |
while video_capture.isOpened():
|
|
@@ -107,6 +107,9 @@ elif input_option == "Upload Video":
|
|
| 107 |
|
| 108 |
# Make predictions using your fire detection model
|
| 109 |
results = model.predict(source=frame, conf=0.5)
|
|
|
|
|
|
|
|
|
|
| 110 |
|
| 111 |
# Draw bounding boxes on the frame if fire is detected
|
| 112 |
for result in results:
|
|
|
|
| 97 |
|
| 98 |
# Create a placeholder for video frame processing
|
| 99 |
video_frame_placeholder = st.empty()
|
| 100 |
+
fire_detected = False
|
| 101 |
|
| 102 |
# Loop through video frames
|
| 103 |
while video_capture.isOpened():
|
|
|
|
| 107 |
|
| 108 |
# Make predictions using your fire detection model
|
| 109 |
results = model.predict(source=frame, conf=0.5)
|
| 110 |
+
# Check if any bounding boxes are detected (fire detected)
|
| 111 |
+
if len(results) > 0 and len(results[0].boxes) > 0:
|
| 112 |
+
fire_detected = True
|
| 113 |
|
| 114 |
# Draw bounding boxes on the frame if fire is detected
|
| 115 |
for result in results:
|