allow skip current image in progress api
This commit is contained in:
parent
9f104b53c4
commit
9f4f894d74
|
@ -167,7 +167,7 @@ class Api:
|
||||||
|
|
||||||
return PNGInfoResponse(info=result[1])
|
return PNGInfoResponse(info=result[1])
|
||||||
|
|
||||||
def progressapi(self):
|
def progressapi(self, req: ProgressRequest = Depends()):
|
||||||
# copy from check_progress_call of ui.py
|
# copy from check_progress_call of ui.py
|
||||||
|
|
||||||
if shared.state.job_count == 0:
|
if shared.state.job_count == 0:
|
||||||
|
@ -188,7 +188,7 @@ class Api:
|
||||||
progress = min(progress, 1)
|
progress = min(progress, 1)
|
||||||
|
|
||||||
current_image = None
|
current_image = None
|
||||||
if shared.state.current_image:
|
if shared.state.current_image and not req.skip_current_image:
|
||||||
current_image = encode_pil_to_base64(shared.state.current_image)
|
current_image = encode_pil_to_base64(shared.state.current_image)
|
||||||
|
|
||||||
return ProgressResponse(progress=progress, eta_relative=eta_relative, state=shared.state.dict(), current_image=current_image)
|
return ProgressResponse(progress=progress, eta_relative=eta_relative, state=shared.state.dict(), current_image=current_image)
|
||||||
|
|
|
@ -157,6 +157,9 @@ class PNGInfoRequest(BaseModel):
|
||||||
class PNGInfoResponse(BaseModel):
|
class PNGInfoResponse(BaseModel):
|
||||||
info: str = Field(title="Image info", description="A string with all the info the image had")
|
info: str = Field(title="Image info", description="A string with all the info the image had")
|
||||||
|
|
||||||
|
class ProgressRequest(BaseModel):
|
||||||
|
skip_current_image: bool = Field(default=False, title="Skip current image", description="Skip current image serialization")
|
||||||
|
|
||||||
class ProgressResponse(BaseModel):
|
class ProgressResponse(BaseModel):
|
||||||
progress: float = Field(title="Progress", description="The progress with a range of 0 to 1")
|
progress: float = Field(title="Progress", description="The progress with a range of 0 to 1")
|
||||||
eta_relative: float = Field(title="ETA in secs")
|
eta_relative: float = Field(title="ETA in secs")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user