Bhavibond commited on
Commit
b511eb8
·
verified ·
1 Parent(s): 56a9dd1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -24,20 +24,17 @@ def preprocess_image(image):
24
  depth_map = np.clip(image, 0, 255)
25
  return Image.fromarray(depth_map)
26
 
27
- def generate_image(prompt, input_image):
28
  """Generate an image using Stable Diffusion ControlNet with IP-Adapter."""
29
  pipe = load_controlnet_model()
30
  processed_image = preprocess_image(input_image)
31
- result = pipe(prompt, image=processed_image, num_inference_steps=50).images[0]
32
  return result
33
 
34
  # Gradio Interface
35
  demo = gr.Interface(
36
  fn=generate_image,
37
- inputs=[
38
- gr.Textbox(label="Enter your prompt"),
39
- gr.Image(type="pil", label="Upload reference image")
40
- ],
41
  outputs=gr.Image(type="pil", label="Generated Image"),
42
  title="Stable Diffusion with ControlNet and IP-Adapter",
43
  description="Generate images with precise object placement and consistent style using ControlNet and IP-Adapter.",
 
24
  depth_map = np.clip(image, 0, 255)
25
  return Image.fromarray(depth_map)
26
 
27
+ def generate_image(input_image):
28
  """Generate an image using Stable Diffusion ControlNet with IP-Adapter."""
29
  pipe = load_controlnet_model()
30
  processed_image = preprocess_image(input_image)
31
+ result = pipe(image=processed_image, num_inference_steps=30).images[0]
32
  return result
33
 
34
  # Gradio Interface
35
  demo = gr.Interface(
36
  fn=generate_image,
37
+ inputs=gr.Image(type="pil", label="Upload reference image"),
 
 
 
38
  outputs=gr.Image(type="pil", label="Generated Image"),
39
  title="Stable Diffusion with ControlNet and IP-Adapter",
40
  description="Generate images with precise object placement and consistent style using ControlNet and IP-Adapter.",