@@ -40,6 +40,7 @@ def __init__(self, app, queue_lock):
40
40
self .app .add_api_route ("/sdapi/v1/extra-batch-images" , self .extras_batch_images_api , methods = ["POST" ], response_model = ExtrasBatchImagesResponse )
41
41
self .app .add_api_route ("/sdapi/v1/png-info" , self .pnginfoapi , methods = ["POST" ], response_model = PNGInfoResponse )
42
42
self .app .add_api_route ("/sdapi/v1/progress" , self .progressapi , methods = ["GET" ], response_model = ProgressResponse )
43
+ self .app .add_api_route ("/sdapi/v1/interrupt" , self .interruptapi , methods = ["POST" ])
43
44
44
45
def text2imgapi (self , txt2imgreq : StableDiffusionTxt2ImgProcessingAPI ):
45
46
sampler_index = sampler_to_index (txt2imgreq .sampler_index )
@@ -176,6 +177,11 @@ def progressapi(self, req: ProgressRequest = Depends()):
176
177
177
178
return ProgressResponse (progress = progress , eta_relative = eta_relative , state = shared .state .dict (), current_image = current_image )
178
179
180
+ def interruptapi (self ):
181
+ shared .state .interrupt ()
182
+
183
+ return {}
184
+
179
185
def launch (self , server_name , port ):
180
186
self .app .include_router (self .router )
181
187
uvicorn .run (self .app , host = server_name , port = port )
0 commit comments