aptol commited on
Commit
9145a6f
·
verified ·
1 Parent(s): 3153d6a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -17
app.py CHANGED
@@ -866,23 +866,24 @@ def step1_gpu_refine(
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
  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")