Spaces:
Runtime error
Runtime error
Ray-1026
commited on
Commit
·
31cffe7
1
Parent(s):
d700496
bfloat
Browse files
app.py
CHANGED
|
@@ -160,9 +160,8 @@ def encode_image(pil_image):
|
|
| 160 |
|
| 161 |
|
| 162 |
## --- Model Loading --- ##
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
dtype = torch.float16 if device == "cuda" else torch.float32
|
| 166 |
print(f"Using device: {device}")
|
| 167 |
|
| 168 |
# controlnet
|
|
@@ -281,7 +280,7 @@ def infer(
|
|
| 281 |
# Blur mask
|
| 282 |
# data["mask_img"] = data["mask_img"].filter(ImageFilter.GaussianBlur(15))
|
| 283 |
|
| 284 |
-
# denoise
|
| 285 |
outpaint_result = pipe(
|
| 286 |
prompt=generated_text,
|
| 287 |
negative_prompt="NSFW, (word:1.5), watermark, blurry, missing body, amputation, mutilation",
|
|
@@ -292,21 +291,8 @@ def infer(
|
|
| 292 |
guidance_scale=cfg,
|
| 293 |
generator=generator,
|
| 294 |
repeat_time=repeat_time,
|
| 295 |
-
progress=progress,
|
| 296 |
).images[0]
|
| 297 |
|
| 298 |
-
# outpaint_result = pipe(
|
| 299 |
-
# prompt=generated_text,
|
| 300 |
-
# negative_prompt="NSFW, (word:1.5), watermark, blurry, missing body, amputation, mutilation",
|
| 301 |
-
# image=data["input_img"],
|
| 302 |
-
# mask_image=data["mask_img"],
|
| 303 |
-
# control_image=data["control_img"],
|
| 304 |
-
# num_inference_steps=num_inference_steps,
|
| 305 |
-
# guidance_scale=cfg,
|
| 306 |
-
# generator=generator,
|
| 307 |
-
# repeat_time=repeat_time,
|
| 308 |
-
# ).images[0]
|
| 309 |
-
|
| 310 |
# save result
|
| 311 |
outpaint_result = np.array(outpaint_result)
|
| 312 |
input_img = np.array(data["input_img"])
|
|
|
|
| 160 |
|
| 161 |
|
| 162 |
## --- Model Loading --- ##
|
| 163 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 164 |
+
dtype = torch.bfloat16
|
|
|
|
| 165 |
print(f"Using device: {device}")
|
| 166 |
|
| 167 |
# controlnet
|
|
|
|
| 280 |
# Blur mask
|
| 281 |
# data["mask_img"] = data["mask_img"].filter(ImageFilter.GaussianBlur(15))
|
| 282 |
|
| 283 |
+
# denoise
|
| 284 |
outpaint_result = pipe(
|
| 285 |
prompt=generated_text,
|
| 286 |
negative_prompt="NSFW, (word:1.5), watermark, blurry, missing body, amputation, mutilation",
|
|
|
|
| 291 |
guidance_scale=cfg,
|
| 292 |
generator=generator,
|
| 293 |
repeat_time=repeat_time,
|
|
|
|
| 294 |
).images[0]
|
| 295 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 296 |
# save result
|
| 297 |
outpaint_result = np.array(outpaint_result)
|
| 298 |
input_img = np.array(data["input_img"])
|