radames commited on
Commit
01e0de2
1 Parent(s): 5ea61e0

queue size concurerecy

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -18,9 +18,9 @@ from PIL import Image
18
 
19
  qrcode_generator = qrcode.QRCode(
20
  version=1,
21
- error_correction=qrcode.constants.ERROR_CORRECT_H,
22
  box_size=10,
23
- border=0,
24
  )
25
 
26
  controlnet = ControlNetModel.from_pretrained(
@@ -32,22 +32,22 @@ pipe = StableDiffusionControlNetImg2ImgPipeline.from_pretrained(
32
  controlnet=controlnet,
33
  safety_checker=None,
34
  torch_dtype=torch.float16,
35
- )
36
 
37
  pipe.enable_xformers_memory_efficient_attention()
38
  pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config)
39
- pipe.enable_model_cpu_offload()
40
 
41
 
42
  sd_pipe = StableDiffusionPipeline.from_pretrained(
43
- "stabilityai/stable-diffusion-2-1", torch_dtype=torch.float16
44
- )
45
- sd_pipe.scheduler = DPMSolverMultistepScheduler.from_config(sd_pipe.scheduler.config)
46
- sd_pipe = sd_pipe.to("cuda")
47
-
48
 
 
49
  sd_pipe.enable_xformers_memory_efficient_attention()
50
- sd_pipe.enable_model_cpu_offload()
51
 
52
 
53
  def resize_for_condition_image(input_image: Image.Image, resolution: int):
@@ -278,5 +278,5 @@ model: https://huggingface.co/DionTimmer/controlnet_qrcode-control_v1p_sd15
278
  cache_examples=True,
279
  )
280
 
281
- blocks.queue(concurrency_count=2)
282
  blocks.launch()
 
18
 
19
  qrcode_generator = qrcode.QRCode(
20
  version=1,
21
+ error_correction=qrcode.ERROR_CORRECT_H,
22
  box_size=10,
23
+ border=4,
24
  )
25
 
26
  controlnet = ControlNetModel.from_pretrained(
 
32
  controlnet=controlnet,
33
  safety_checker=None,
34
  torch_dtype=torch.float16,
35
+ ).to("cuda")
36
 
37
  pipe.enable_xformers_memory_efficient_attention()
38
  pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config)
39
+ # pipe.enable_model_cpu_offload()
40
 
41
 
42
  sd_pipe = StableDiffusionPipeline.from_pretrained(
43
+ "stabilityai/stable-diffusion-2-1",
44
+ torch_dtype=torch.float16,
45
+ safety_checker=None,
46
+ ).to("cuda")
 
47
 
48
+ sd_pipe.scheduler = DPMSolverMultistepScheduler.from_config(sd_pipe.scheduler.config)
49
  sd_pipe.enable_xformers_memory_efficient_attention()
50
+ # sd_pipe.enable_model_cpu_offload()
51
 
52
 
53
  def resize_for_condition_image(input_image: Image.Image, resolution: int):
 
278
  cache_examples=True,
279
  )
280
 
281
+ blocks.queue(concurrency_count=1, max_size=20)
282
  blocks.launch()