example API working with gradio

This commit is contained in:
arcticfaded
2022-10-17 19:10:36 +00:00
parent d42125baf6
commit f80e914ac4
3 changed files with 60 additions and 27 deletions

View File

@@ -23,8 +23,13 @@ class Api:
app.add_api_route("/v1/txt2img", self.text2imgapi, methods=["POST"])
def text2imgapi(self, txt2imgreq: StableDiffusionProcessingAPI ):
p = StableDiffusionProcessingTxt2Img(**vars(txt2imgreq))
p.sd_model = shared.sd_model
populate = txt2imgreq.copy(update={ # Override __init__ params
"sd_model": shared.sd_model,
"sampler_index": 0,
}
)
p = StableDiffusionProcessingTxt2Img(**vars(populate))
# Override object param
processed = process_images(p)
b64images = []