@@ -112,11 +112,13 @@ def auth(self, credenticals: HTTPBasicCredentials = Depends(HTTPBasic())):
112
112
def text2imgapi (self , txt2imgreq : StableDiffusionTxt2ImgProcessingAPI ):
113
113
populate = txt2imgreq .copy (update = { # Override __init__ params
114
114
"sd_model" : shared .sd_model ,
115
- "sampler_name" : validate_sampler_name (txt2imgreq .sampler_index ),
115
+ "sampler_name" : validate_sampler_name (txt2imgreq .sampler_name or txt2imgreq . sampler_index ),
116
116
"do_not_save_samples" : True ,
117
117
"do_not_save_grid" : True
118
118
}
119
119
)
120
+ if populate .sampler_name :
121
+ populate .sampler_index = None # prevent a warning later on
120
122
p = StableDiffusionProcessingTxt2Img (** vars (populate ))
121
123
# Override object param
122
124
@@ -142,12 +144,14 @@ def img2imgapi(self, img2imgreq: StableDiffusionImg2ImgProcessingAPI):
142
144
143
145
populate = img2imgreq .copy (update = { # Override __init__ params
144
146
"sd_model" : shared .sd_model ,
145
- "sampler_name" : validate_sampler_name (img2imgreq .sampler_index ),
147
+ "sampler_name" : validate_sampler_name (img2imgreq .sampler_name or img2imgreq . sampler_index ),
146
148
"do_not_save_samples" : True ,
147
149
"do_not_save_grid" : True ,
148
150
"mask" : mask
149
151
}
150
152
)
153
+ if populate .sampler_name :
154
+ populate .sampler_index = None # prevent a warning later on
151
155
p = StableDiffusionProcessingImg2Img (** vars (populate ))
152
156
153
157
imgs = []
0 commit comments