Backend changes to support stopping a task mid-way. Uses a custom patch for the stable-diffusion codebase, to make it call a callback for DDIM

This commit is contained in:
cmdr2
2022-09-13 19:59:41 +05:30
parent 9ec2010ac2
commit e59c66ae26
5 changed files with 88 additions and 7 deletions

View File

@ -83,7 +83,7 @@ async def ping():
return HTTPException(status_code=500, detail=str(e))
@app.post('/image')
async def image(req : ImageRequest):
def image(req : ImageRequest):
from sd_internal import runtime
r = Request()
@ -114,6 +114,20 @@ async def image(req : ImageRequest):
print(traceback.format_exc())
return HTTPException(status_code=500, detail=str(e))
@app.get('/image/stop')
def stop():
try:
if model_is_loading:
return {'ERROR'}
from sd_internal import runtime
runtime.stop_processing = True
return {'OK'}
except Exception as e:
print(traceback.format_exc())
return HTTPException(status_code=500, detail=str(e))
@app.post('/app_config')
async def setAppConfig(req : SetAppConfigRequest):
try: