Commit 71d42bb4 authored by Jonathan's avatar Jonathan Committed by AUTOMATIC1111

Update api.py

parent 99013ba6
......@@ -23,10 +23,8 @@ class Api:
app.add_api_route("/v1/txt2img", self.text2imgapi, methods=["POST"])
def text2imgapi(self, txt2imgreq: StableDiffusionProcessingAPI ):
print(txt2imgreq)
p = StableDiffusionProcessingTxt2Img(**vars(txt2imgreq))
p.sd_model = shared.sd_model
print(p)
processed = process_images(p)
b64images = []
......@@ -34,13 +32,6 @@ class Api:
buffer = io.BytesIO()
i.save(buffer, format="png")
b64images.append(base64.b64encode(buffer.getvalue()))
response = {
"images": b64images,
"info": processed.js(),
"parameters": json.dumps(vars(txt2imgreq))
}
return TextToImageResponse(images=b64images, parameters=json.dumps(vars(txt2imgreq)), info=json.dumps(processed.info))
......@@ -57,4 +48,4 @@ class Api:
def launch(self, server_name, port):
app.include_router(self.router)
uvicorn.run(app, host=server_name, port=port)
\ No newline at end of file
uvicorn.run(app, host=server_name, port=port)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment