Lifeinhockey commited on
Commit
6e983aa
·
verified ·
1 Parent(s): f4bcc02

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -405,14 +405,9 @@ def infer(
405
  cn_source_image = preprocess_image(cn_source_image, width, height)
406
  control_image = preprocess_image(control_image, width, height)
407
 
408
- # prompt_embeds = long_prompt_encoder(prompt, pipe_controlnet.tokenizer, pipe_controlnet.text_encoder)
409
- # negative_prompt_embeds = long_prompt_encoder(negative_prompt, pipe_controlnet.tokenizer, pipe_controlnet.text_encoder)
410
- # prompt_embeds, negative_prompt_embeds = align_embeddings(prompt_embeds, negative_prompt_embeds)
411
  image = pipe_controlnet(
412
  prompt=prompt,
413
  negative_prompt=negative_prompt,
414
- # prompt_embeds=prompt_embeds,
415
- # negative_prompt_embeds=negative_prompt_embeds,
416
  image=cn_source_image,
417
  control_image=control_image,
418
  strength=strength_cn, # Коэфф. зашумления, чем больше, тем больше меняется результирующее изображение относитенльно исходного
@@ -429,6 +424,10 @@ def infer(
429
 
430
  print('control_mode = ', control_mode)
431
 
 
 
 
 
432
  depth_estimator = pipeline("depth-estimation")
433
  depth_map = get_depth_map(control_image, depth_estimator).unsqueeze(0).half().to(device)
434
 
@@ -641,7 +640,6 @@ with gr.Blocks(css=css) as demo:
641
  control_image = gr.Image(label="Upload Control Net Image")
642
 
643
  use_control_net.change(
644
- #fn=lambda x: gr.Row.update(visible=x),
645
  fn=lambda x: gr.update(visible=x),
646
  inputs=use_control_net,
647
  outputs=control_net_options
@@ -688,7 +686,6 @@ with gr.Blocks(css=css) as demo:
688
  ip_adapter_image = gr.Image(label="Upload IP_Adapter Image")
689
 
690
  use_ip_adapter.change(
691
- #fn=lambda x: gr.Row.update(visible=x),
692
  fn=lambda x: gr.update(visible=x),
693
  inputs=use_ip_adapter,
694
  outputs=ip_adapter_options
 
405
  cn_source_image = preprocess_image(cn_source_image, width, height)
406
  control_image = preprocess_image(control_image, width, height)
407
 
 
 
 
408
  image = pipe_controlnet(
409
  prompt=prompt,
410
  negative_prompt=negative_prompt,
 
 
411
  image=cn_source_image,
412
  control_image=control_image,
413
  strength=strength_cn, # Коэфф. зашумления, чем больше, тем больше меняется результирующее изображение относитенльно исходного
 
424
 
425
  print('control_mode = ', control_mode)
426
 
427
+ # Преобразуем изображения
428
+ cn_source_image = preprocess_image(cn_source_image, width, height)
429
+ control_image = preprocess_image(control_image, width, height)
430
+
431
  depth_estimator = pipeline("depth-estimation")
432
  depth_map = get_depth_map(control_image, depth_estimator).unsqueeze(0).half().to(device)
433
 
 
640
  control_image = gr.Image(label="Upload Control Net Image")
641
 
642
  use_control_net.change(
 
643
  fn=lambda x: gr.update(visible=x),
644
  inputs=use_control_net,
645
  outputs=control_net_options
 
686
  ip_adapter_image = gr.Image(label="Upload IP_Adapter Image")
687
 
688
  use_ip_adapter.change(
 
689
  fn=lambda x: gr.update(visible=x),
690
  inputs=use_ip_adapter,
691
  outputs=ip_adapter_options