next frame if image is None
Browse files- app_init.py +2 -5
app_init.py
CHANGED
@@ -121,17 +121,14 @@ def init_app(app: FastAPI, user_data: UserData, args: Args, pipeline):
|
|
121 |
last_params = params
|
122 |
image = pipeline.predict(params)
|
123 |
if image is None:
|
|
|
124 |
continue
|
125 |
frame = pil_to_frame(image)
|
126 |
yield frame
|
127 |
# https://bugs.chromium.org/p/chromium/issues/detail?id=1250396
|
128 |
if not is_firefox(request.headers["user-agent"]):
|
129 |
yield frame
|
130 |
-
await websocket.send_json(
|
131 |
-
{
|
132 |
-
"status": "send_frame",
|
133 |
-
}
|
134 |
-
)
|
135 |
|
136 |
return StreamingResponse(
|
137 |
generate(),
|
|
|
121 |
last_params = params
|
122 |
image = pipeline.predict(params)
|
123 |
if image is None:
|
124 |
+
await websocket.send_json({"status": "send_frame"})
|
125 |
continue
|
126 |
frame = pil_to_frame(image)
|
127 |
yield frame
|
128 |
# https://bugs.chromium.org/p/chromium/issues/detail?id=1250396
|
129 |
if not is_firefox(request.headers["user-agent"]):
|
130 |
yield frame
|
131 |
+
await websocket.send_json({"status": "send_frame"})
|
|
|
|
|
|
|
|
|
132 |
|
133 |
return StreamingResponse(
|
134 |
generate(),
|