AP123 commited on
Commit
04cb33c
1 Parent(s): 811e3ea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -43,14 +43,17 @@ def inference(
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()
50
 
51
  out = pipe(
52
  prompt=prompt,
53
  negative_prompt=negative_prompt,
 
54
  control_image=control_image,
55
  guidance_scale=guidance_scale,
56
  controlnet_conditioning_scale=controlnet_conditioning_scale,
@@ -93,6 +96,4 @@ with gr.Blocks() as app:
93
  app.queue(concurrency_count=4, max_size=20)
94
 
95
  if __name__ == "__main__":
96
- app.launch(debug=True)
97
-
98
-
 
43
  if prompt is None or prompt == "":
44
  raise gr.Error("Prompt is required")
45
 
46
+ # Generate init_image using the "Realistic Vision V2.0" model
47
+ init_image = pipe(prompt, height=512, width=512).images[0]
48
 
49
+ control_image = control_image.resize((512, 512))
50
  pipe.scheduler = SAMPLER_MAP[sampler](pipe.scheduler.config)
51
  generator = torch.manual_seed(seed) if seed != -1 else torch.Generator()
52
 
53
  out = pipe(
54
  prompt=prompt,
55
  negative_prompt=negative_prompt,
56
+ image=init_image,
57
  control_image=control_image,
58
  guidance_scale=guidance_scale,
59
  controlnet_conditioning_scale=controlnet_conditioning_scale,
 
96
  app.queue(concurrency_count=4, max_size=20)
97
 
98
  if __name__ == "__main__":
99
+ app.launch(debug=True)