fffiloni commited on
Commit
b7751ed
1 Parent(s): ea6de43

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -52,12 +52,14 @@ def resize_image(input_path, output_path, target_height):
52
  # Save the resized image
53
  img.save(output_path)
54
 
55
- return output_path
56
 
57
  def infer(image_in, prompt, inference_steps, guidance_scale, control_weight):
58
 
59
  n_prompt = 'NSFW, nude, naked, porn, ugly'
60
 
 
 
61
  # Canny preprocessing
62
  image_to_canny = load_image(image_in)
63
  image_to_canny = np.array(image_to_canny)
@@ -83,6 +85,8 @@ def infer(image_in, prompt, inference_steps, guidance_scale, control_weight):
83
  controlnet_conditioning=controlnet_conditioning,
84
  num_inference_steps=inference_steps,
85
  guidance_scale=guidance_scale,
 
 
86
  ).images[0]
87
 
88
  return image, image_to_canny
 
52
  # Save the resized image
53
  img.save(output_path)
54
 
55
+ return output_path, new_width, target_height
56
 
57
  def infer(image_in, prompt, inference_steps, guidance_scale, control_weight):
58
 
59
  n_prompt = 'NSFW, nude, naked, porn, ugly'
60
 
61
+ image_in, w, h = resize_image(image_in, "resized_input.jpg", 1024)
62
+
63
  # Canny preprocessing
64
  image_to_canny = load_image(image_in)
65
  image_to_canny = np.array(image_to_canny)
 
85
  controlnet_conditioning=controlnet_conditioning,
86
  num_inference_steps=inference_steps,
87
  guidance_scale=guidance_scale,
88
+ width=w,
89
+ height=h
90
  ).images[0]
91
 
92
  return image, image_to_canny