Skip to content

Commit

Permalink
Merge pull request #984 from roboflow/select-first-workflow-image-out…
Browse files Browse the repository at this point in the history
…put-for-sending-through-webrtc

When stream output received in camera streaming payload is not WorkflowImageData, select first available WorkflowImageData output
  • Loading branch information
grzegorz-roboflow authored Jan 28, 2025
2 parents 2bd69ad + 2062efe commit 29de265
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,15 +293,6 @@ def webrtc_sink(
"Please try to adjust the scene so models detect objects"
)
errors.append("or stop preview, update workflow and try again.")
elif parsed_payload.stream_output[0] not in prediction:
if not parsed_payload.stream_output[0]:
errors.append("No stream output selected to show")
else:
errors.append(
f"{parsed_payload.stream_output[0]} not available in results"
)
errors.append("Please stop, update outputs and try again")
if errors:
result_frame = video_frame.image.copy()
for row, error in enumerate(errors):
result_frame = cv.putText(
Expand All @@ -315,6 +306,13 @@ def webrtc_sink(
)
from_inference_queue.sync_put(result_frame)
return
if parsed_payload.stream_output[0] not in prediction or not isinstance(
prediction[parsed_payload.stream_output[0]], WorkflowImageData
):
for output in prediction.values():
if isinstance(output, WorkflowImageData):
from_inference_queue.sync_put(output.numpy_image)
return
from_inference_queue.sync_put(
prediction[parsed_payload.stream_output[0]].numpy_image
)
Expand Down

0 comments on commit 29de265

Please sign in to comment.