Skip to content

Commit 9f4f894

Browse files
committed
allow skip current image in progress api
1 parent 9f104b5 commit 9f4f894

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

modules/api/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def pnginfoapi(self, req: PNGInfoRequest):
167167

168168
return PNGInfoResponse(info=result[1])
169169

170-
def progressapi(self):
170+
def progressapi(self, req: ProgressRequest = Depends()):
171171
# copy from check_progress_call of ui.py
172172

173173
if shared.state.job_count == 0:
@@ -188,7 +188,7 @@ def progressapi(self):
188188
progress = min(progress, 1)
189189

190190
current_image = None
191-
if shared.state.current_image:
191+
if shared.state.current_image and not req.skip_current_image:
192192
current_image = encode_pil_to_base64(shared.state.current_image)
193193

194194
return ProgressResponse(progress=progress, eta_relative=eta_relative, state=shared.state.dict(), current_image=current_image)

modules/api/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ class PNGInfoRequest(BaseModel):
157157
class PNGInfoResponse(BaseModel):
158158
info: str = Field(title="Image info", description="A string with all the info the image had")
159159

160+
class ProgressRequest(BaseModel):
161+
skip_current_image: bool = Field(default=False, title="Skip current image", description="Skip current image serialization")
162+
160163
class ProgressResponse(BaseModel):
161164
progress: float = Field(title="Progress", description="The progress with a range of 0 to 1")
162165
eta_relative: float = Field(title="ETA in secs")

0 commit comments

Comments
 (0)