karthi12334r5 commited on
Commit
03840de
·
verified ·
1 Parent(s): 807e604

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -11,13 +11,21 @@ pipe = StableDiffusionControlNetPipeline.from_pretrained(
11
  controlnet=controlnet,
12
  torch_dtype=torch.float16,
13
  safety_checker=None
14
- ).to("cuda")
15
 
16
  pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
 
17
 
18
  def generate(image, prompt="a person posing"):
19
  result = pipe(prompt=prompt, image=image, num_inference_steps=20).images[0]
20
  return result
21
 
22
- demo = gr.Interface(fn=generate, inputs=[gr.Image(type="pil"), gr.Textbox()], outputs="image")
 
 
 
 
 
 
 
23
  demo.launch()
 
11
  controlnet=controlnet,
12
  torch_dtype=torch.float16,
13
  safety_checker=None
14
+ )
15
 
16
  pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
17
+ pipe.to("cuda" if torch.cuda.is_available() else "cpu")
18
 
19
  def generate(image, prompt="a person posing"):
20
  result = pipe(prompt=prompt, image=image, num_inference_steps=20).images[0]
21
  return result
22
 
23
+ demo = gr.Interface(
24
+ fn=generate,
25
+ inputs=[gr.Image(type="pil"), gr.Textbox(label="Prompt")],
26
+ outputs="image",
27
+ title="Pose Generator",
28
+ description="Upload an image and enter a prompt to generate a ControlNet-based pose output."
29
+ )
30
+
31
  demo.launch()