WildanJR commited on
Commit
76d0993
·
verified ·
1 Parent(s): ded857c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -13,6 +13,8 @@ from replace_bg.utilities import resize_image, remove_bg_from_image, paste_fg_ov
13
  controlnet = ControlNetModel.from_pretrained("briaai/BRIA-2.3-ControlNet-BG-Gen", torch_dtype=torch.float16)
14
  vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
15
  pipe = StableDiffusionXLControlNetPipeline.from_pretrained("briaai/BRIA-2.3", controlnet=controlnet, torch_dtype=torch.float16, vae=vae).to('cuda:0')
 
 
16
  pipe.scheduler = EulerAncestralDiscreteScheduler(
17
  beta_start=0.00085,
18
  beta_end=0.012,
@@ -31,6 +33,7 @@ def generate_(prompt, negative_prompt, control_tensor, num_steps, controlnet_con
31
  controlnet_conditioning_scale=float(controlnet_conditioning_scale),
32
  num_inference_steps=num_steps,
33
  image = control_tensor,
 
34
  generator=generator
35
  ).images[0]
36
 
@@ -62,7 +65,7 @@ This model has been trained on a carefully selected dataset, which includes: gen
62
  ''')
63
  with gr.Row():
64
  with gr.Column():
65
- input_image = gr.Image(sources='upload', type="pil", label="Upload", elem_id="image_upload", height=600) # None for upload, ctrl+v and webcam
66
  prompt = gr.Textbox(label="Prompt")
67
  negative_prompt = gr.Textbox(label="Negative prompt", value="Logo,Watermark,Text,Ugly,Morbid,Extra fingers,Poorly drawn hands,Mutation,Blurry,Extra limbs,Gross proportions,Missing arms,Mutated hands,Long neck,Duplicate,Mutilated,Mutilated hands,Poorly drawn face,Deformed,Bad anatomy,Cloned face,Malformed limbs,Missing legs,Too many fingers")
68
  num_steps = gr.Slider(label="Number of steps", minimum=10, maximum=100, value=30, step=1)
 
13
  controlnet = ControlNetModel.from_pretrained("briaai/BRIA-2.3-ControlNet-BG-Gen", torch_dtype=torch.float16)
14
  vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
15
  pipe = StableDiffusionXLControlNetPipeline.from_pretrained("briaai/BRIA-2.3", controlnet=controlnet, torch_dtype=torch.float16, vae=vae).to('cuda:0')
16
+ pipe.load_lora_weights(".", weight_name="77d3c43e-96be-4ecf-b102-4acf0d1abe09_4092_678_webui.safetensors")
17
+
18
  pipe.scheduler = EulerAncestralDiscreteScheduler(
19
  beta_start=0.00085,
20
  beta_end=0.012,
 
33
  controlnet_conditioning_scale=float(controlnet_conditioning_scale),
34
  num_inference_steps=num_steps,
35
  image = control_tensor,
36
+ cross_attention_kwargs={"scale": 0.9},
37
  generator=generator
38
  ).images[0]
39
 
 
65
  ''')
66
  with gr.Row():
67
  with gr.Column():
68
+ input_image = gr.Image(sources='upload', type="pil", label="Upload", elem_id="image_upload", height=600) # None for upload, ctrl+v and webcam
69
  prompt = gr.Textbox(label="Prompt")
70
  negative_prompt = gr.Textbox(label="Negative prompt", value="Logo,Watermark,Text,Ugly,Morbid,Extra fingers,Poorly drawn hands,Mutation,Blurry,Extra limbs,Gross proportions,Missing arms,Mutated hands,Long neck,Duplicate,Mutilated,Mutilated hands,Poorly drawn face,Deformed,Bad anatomy,Cloned face,Malformed limbs,Missing legs,Too many fingers")
71
  num_steps = gr.Slider(label="Number of steps", minimum=10, maximum=100, value=30, step=1)