diff --git a/docker-compose.yml b/docker-compose.yml index 844a6373..962f4e70 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: container_name: sd ports: - '5000:5000' - image: 'r8.im/stability-ai/stable-diffusion@sha256:06eb78b36068500c616a7f33c15e6fa40404f8e14b5bfad57ebe0c7fe0f6bdf1' + image: 'r8.im/andreasjansson/stable-diffusion-wip@sha256:984cf13f8875bf9eec0860e87ce41143f40b6f07f0112505c6833147763353ad' deploy: resources: reservations: diff --git a/index.html b/index.html index cbdecff9..43dfb5f8 100644 --- a/index.html +++ b/index.html @@ -6,6 +6,9 @@ font-family: Arial, Helvetica, sans-serif; font-size: 11pt; } + label { + font-size: 10pt; + } #prompt { width: 50vw; height: 50pt; @@ -15,6 +18,23 @@ width: 95%; } } + #init_image_preview_container { + display: none; + } + #init_image_clear { + position: absolute; + transform: translateX(-50%); + background: black; + color: white; + border: 2pt solid #ccc; + padding: 0; + cursor: pointer; + outline: inherit; + border-radius: 8pt; + width: 16pt; + height: 16pt; + font-size: 10pt; + } #configHeader { margin-top: 5px; margin-bottom: 5px; @@ -29,10 +49,21 @@ font-size: small; } #footer { - margin-top: 5px; - padding-top: 5px; + border-top: 1px solid #999; + margin-top: 10px; + padding-top: 10px; font-size: small; } + .imgUseBtn { + position: absolute; + transform: translateX(-100%); + margin-top: 5pt; + margin-left: -5pt; + } + .imgItem { + display: inline; + padding-right: 10px; + } @@ -43,6 +74,12 @@ Prompt:

+
+
+ + +
+
Advanced settings: [show]

@@ -70,6 +107,28 @@ diff --git a/main.py b/main.py index 9f6b0689..08c10258 100644 --- a/main.py +++ b/main.py @@ -1,4 +1,4 @@ -from fastapi import FastAPI +from fastapi import FastAPI, HTTPException from starlette.responses import FileResponse from pydantic import BaseModel @@ -12,6 +12,7 @@ app = FastAPI() # defaults from https://huggingface.co/blog/stable_diffusion class ImageRequest(BaseModel): prompt: str + init_image: str = None # base64 num_outputs: str = "1" num_inference_steps: str = "50" guidance_scale: str = "7.5" @@ -45,10 +46,16 @@ async def image(req : ImageRequest): } } + if req.init_image is not None: + data['input']['init_image'] = req.init_image + if req.seed == "-1": del data['input']['seed'] res = requests.post(PREDICT_URL, json=data) + if res.status_code != 200: + raise HTTPException(status_code=500, detail=res.text) + return res.json() @app.get('/media/ding.mp3')