Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed Dec 13, 2023
1 parent b4c9940 commit 217788b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
import { rejects } from "assert";
let value: string;
let promptPlaceholder: string = "studio ghibli, 8k, wolf ...";
let promptPlaceholder: string = "studio ghibli, 8k, wolf etc....";
let promptPlaceholderValue: string = "studio ghibli, 8k, wolf";
let imgInput: HTMLImageElement;
let imgOutput: HTMLImageElement;
let canvasDrawLayer: HTMLCanvasElement;
Expand Down Expand Up @@ -211,7 +212,7 @@
const formData = new FormData();
formData.append("image", data, "image.jpg");
formData.append("prompt", value || promptPlaceholder);
formData.append("prompt", value || promptPlaceholderValue);
const sentAt = new Date().getTime();
fetch(window.INFERENCE_BASE_URL, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import base64
import json
import time
from pathlib import Path

Expand Down Expand Up @@ -82,13 +80,17 @@ def __enter__(self):
)

@web_endpoint(method="POST")
async def inference(self, image: UploadFile = File(...), prompt: str = Form(...)):
async def inference(
self, image: UploadFile = File(...), prompt: str = Form(...)
):
t00 = time.time()
img_data_in = await image.read()
print("loading time:", time.time() - t00)

init_image = load_image(Image.open(BytesIO(img_data_in))).resize((512, 512))
num_inference_steps = 2
init_image = load_image(Image.open(BytesIO(img_data_in))).resize(
(512, 512)
)
num_inference_steps = 3
# note: anything under 0.5 strength gives blurry results
strength = 0.55
assert num_inference_steps * strength >= 1
Expand Down

0 comments on commit 217788b

Please sign in to comment.