Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,20 +8,19 @@ model = YOLO("best.pt") # Ensure the path to your model is correct
|
|
| 8 |
|
| 9 |
# Set the title of the app
|
| 10 |
st.title("Live Fire Detection App")
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
# webcamera.set(cv2.CAP_PROP_FRAME_HEIGHT, 1080)
|
| 15 |
|
| 16 |
while True:
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
results = model.track(frame, classes=0, conf=0.8, imgsz=480)
|
| 20 |
-
cv2.putText(frame, f"Total: {len(results[0].boxes)}", (50, 50), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2, cv2.LINE_AA)
|
| 21 |
-
cv2.imshow("Live Camera", results[0].plot())
|
| 22 |
|
| 23 |
if cv2.waitKey(1) == ord('q'):
|
| 24 |
break
|
| 25 |
|
| 26 |
-
|
| 27 |
-
cv2.destroyAllWindows(
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
# Set the title of the app
|
| 10 |
st.title("Live Fire Detection App")
|
| 11 |
+
cap = cv2.VideoCapture(0)
|
| 12 |
+
cap.set(3, 640)
|
| 13 |
+
cap.set(4, 480)
|
|
|
|
| 14 |
|
| 15 |
while True:
|
| 16 |
+
ret, img= cap.read()
|
| 17 |
+
cv2.imshow('Webcam', img)
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
if cv2.waitKey(1) == ord('q'):
|
| 20 |
break
|
| 21 |
|
| 22 |
+
cap.release()
|
| 23 |
+
cv2.destroyAllWindows(
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
|