Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -101,7 +101,10 @@ def predict_video(input_video: str):
|
|
| 101 |
processed_frame = cv2.resize(processed_frame, (width, height))
|
| 102 |
|
| 103 |
# Add text with prediction and confidence
|
| 104 |
-
|
|
|
|
|
|
|
|
|
|
| 105 |
cv2.putText(processed_frame, text, (10, 30), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)
|
| 106 |
|
| 107 |
out.write(processed_frame)
|
|
|
|
| 101 |
processed_frame = cv2.resize(processed_frame, (width, height))
|
| 102 |
|
| 103 |
# Add text with prediction and confidence
|
| 104 |
+
if prediction is not None and confidence is not None:
|
| 105 |
+
text = f"{prediction}: {confidence:.2f}"
|
| 106 |
+
else:
|
| 107 |
+
text = "No prediction available"
|
| 108 |
cv2.putText(processed_frame, text, (10, 30), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)
|
| 109 |
|
| 110 |
out.write(processed_frame)
|