fffiloni commited on
Commit
a05d9c5
1 Parent(s): a66a72b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -34,13 +34,13 @@ pipe.load_lora_weights(custom_model, use_auth_token=True)
34
  pipe.to("cuda")
35
  #pipe.enable_model_cpu_offload()
36
 
37
- def infer(image_in, prompt):
38
  prompt = prompt
39
  negative_prompt = ""
40
 
41
  image = load_image(image_in)
42
 
43
- controlnet_conditioning_scale = 0.25 # recommended for good generalization
44
 
45
  image = np.array(image)
46
  image = cv2.Canny(image, 100, 200)
@@ -52,8 +52,8 @@ def infer(image_in, prompt):
52
  prompt,
53
  negative_prompt=negative_prompt,
54
  image=image,
55
- #controlnet_conditioning_scale=controlnet_conditioning_scale,
56
- guidance_scale = 5.0,
57
  num_inference_steps=50
58
  ).images
59
 
@@ -65,12 +65,14 @@ with gr.Blocks() as demo:
65
  with gr.Column():
66
  image_in = gr.Image(source="upload", type="filepath")
67
  prompt = gr.Textbox(label="Prompt")
 
 
68
  submit_btn = gr.Button("Submit")
69
  result = gr.Image(label="Result")
70
 
71
  submit_btn.click(
72
  fn = infer,
73
- inputs = [image_in, prompt],
74
  outputs = [result]
75
  )
76
 
 
34
  pipe.to("cuda")
35
  #pipe.enable_model_cpu_offload()
36
 
37
+ def infer(image_in, prompt, controlnet_conditioning_scale, guidance_scale):
38
  prompt = prompt
39
  negative_prompt = ""
40
 
41
  image = load_image(image_in)
42
 
43
+ #controlnet_conditioning_scale = 0.25 # recommended for good generalization
44
 
45
  image = np.array(image)
46
  image = cv2.Canny(image, 100, 200)
 
52
  prompt,
53
  negative_prompt=negative_prompt,
54
  image=image,
55
+ controlnet_conditioning_scale=controlnet_conditioning_scale,
56
+ guidance_scale = guidance_scale,
57
  num_inference_steps=50
58
  ).images
59
 
 
65
  with gr.Column():
66
  image_in = gr.Image(source="upload", type="filepath")
67
  prompt = gr.Textbox(label="Prompt")
68
+ guidance_scale = gr.Slider(label="Guidance Scale", minimum=1.0, maximum=10.0, step=0.1, value=5.0)
69
+ controlnet_conditioning_scale = gr.Slider(label="Controlnet conditioning Scale", minimum=0.0, maximum=1.0, step=0.01, value=0.5)
70
  submit_btn = gr.Button("Submit")
71
  result = gr.Image(label="Result")
72
 
73
  submit_btn.click(
74
  fn = infer,
75
+ inputs = [image_in, prompt, controlnet_conditioning_scale, guidance_scale ],
76
  outputs = [result]
77
  )
78