AP123 commited on
Commit
5921c24
1 Parent(s): 4570ac5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -31,6 +31,7 @@ SAMPLER_MAP = {
31
  }
32
 
33
  def inference(
 
34
  prompt: str,
35
  negative_prompt: str,
36
  guidance_scale: float = 8.0,
@@ -42,7 +43,7 @@ def inference(
42
  if prompt is None or prompt == "":
43
  raise gr.Error("Prompt is required")
44
 
45
- input_image = input_image.resize((512, 512))
46
 
47
  pipe.scheduler = SAMPLER_MAP[sampler](pipe.scheduler.config)
48
  generator = torch.manual_seed(seed) if seed != -1 else torch.Generator()
@@ -51,7 +52,7 @@ def inference(
51
  prompt=prompt,
52
  negative_prompt=negative_prompt,
53
  image=None,
54
- control_image=input_image,
55
  guidance_scale=float(guidance_scale),
56
  controlnet_conditioning_scale=float(controlnet_conditioning_scale),
57
  generator=generator,
@@ -71,7 +72,7 @@ with gr.Blocks() as app:
71
 
72
  with gr.Row():
73
  with gr.Column():
74
- input_image = gr.Image(label="Input Illusion", type="pil")
75
  prompt = gr.Textbox(label="Prompt")
76
  negative_prompt = gr.Textbox(label="Negative Prompt", value="ugly, disfigured, low quality, blurry, nsfw")
77
  with gr.Accordion(label="Advanced Options", open=False):
@@ -86,7 +87,7 @@ with gr.Blocks() as app:
86
 
87
  run_btn.click(
88
  inference,
89
- inputs=[prompt, negative_prompt, guidance_scale, controlnet_conditioning_scale, strength, seed, sampler],
90
  outputs=[result_image]
91
  )
92
 
 
31
  }
32
 
33
  def inference(
34
+ control_image: Image.Image,
35
  prompt: str,
36
  negative_prompt: str,
37
  guidance_scale: float = 8.0,
 
43
  if prompt is None or prompt == "":
44
  raise gr.Error("Prompt is required")
45
 
46
+ control_image = control_image.resize((512, 512))
47
 
48
  pipe.scheduler = SAMPLER_MAP[sampler](pipe.scheduler.config)
49
  generator = torch.manual_seed(seed) if seed != -1 else torch.Generator()
 
52
  prompt=prompt,
53
  negative_prompt=negative_prompt,
54
  image=None,
55
+ control_image=control_image,
56
  guidance_scale=float(guidance_scale),
57
  controlnet_conditioning_scale=float(controlnet_conditioning_scale),
58
  generator=generator,
 
72
 
73
  with gr.Row():
74
  with gr.Column():
75
+ control_image = gr.Image(label="Control Image", type="pil")
76
  prompt = gr.Textbox(label="Prompt")
77
  negative_prompt = gr.Textbox(label="Negative Prompt", value="ugly, disfigured, low quality, blurry, nsfw")
78
  with gr.Accordion(label="Advanced Options", open=False):
 
87
 
88
  run_btn.click(
89
  inference,
90
+ inputs=[control_image, prompt, negative_prompt, guidance_scale, controlnet_conditioning_scale, strength, seed, sampler],
91
  outputs=[result_image]
92
  )
93