mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-08-04 11:12:35 +00:00
example API working with gradio
This commit is contained in:
@@ -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 = []
|
||||
|
Reference in New Issue
Block a user