Update app.py
Browse files
app.py
CHANGED
|
@@ -866,23 +866,24 @@ def step1_gpu_refine(
|
|
| 866 |
|
| 867 |
|
| 868 |
# ---- (옵션) 리드로우(img2img)
|
| 869 |
-
|
| 870 |
-
|
| 871 |
-
|
| 872 |
-
|
| 873 |
-
|
| 874 |
-
|
| 875 |
-
|
| 876 |
-
|
| 877 |
-
|
| 878 |
-
|
| 879 |
-
|
| 880 |
-
|
| 881 |
-
|
| 882 |
-
|
| 883 |
-
|
| 884 |
-
|
| 885 |
-
|
|
|
|
| 886 |
|
| 887 |
|
| 888 |
img = out.convert("RGBA")
|
|
|
|
| 866 |
|
| 867 |
|
| 868 |
# ---- (옵션) 리드로우(img2img)
|
| 869 |
+
if do_redraw_flag:
|
| 870 |
+
from diffusers import StableDiffusionImg2ImgPipeline
|
| 871 |
+
pr = StableDiffusionImg2ImgPipeline.from_pretrained(
|
| 872 |
+
"runwayml/stable-diffusion-v1-5", torch_dtype=dtype,
|
| 873 |
+
safety_checker=None, feature_extractor=None
|
| 874 |
+
)
|
| 875 |
+
pr = _disable_safety(pr)
|
| 876 |
+
if dev == "cuda": pr.to("cuda")
|
| 877 |
+
img_for = _resize_to_multiple(img.convert("RGB"), 8, 640)
|
| 878 |
+
img = pr(
|
| 879 |
+
prompt="clean anime illustration, sharp lines, flat colors, plain white background",
|
| 880 |
+
negative_prompt="glitch, mosaic, text, watermark, noisy",
|
| 881 |
+
image=img_for,
|
| 882 |
+
strength=float(max(0.30, min(0.45, float(redraw_strength)))),
|
| 883 |
+
guidance_scale=float(max(6.5, min(9.0, float(redraw_guidance)))),
|
| 884 |
+
num_inference_steps=int(max(14, min(28, int(redraw_steps)))),
|
| 885 |
+
).images[0].convert("RGBA")
|
| 886 |
+
|
| 887 |
|
| 888 |
|
| 889 |
img = out.convert("RGBA")
|