Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -44,10 +44,10 @@ def resize_image(image):
|
|
44 |
|
45 |
|
46 |
@spaces.GPU
|
47 |
-
def generate_(prompt, negative_prompt,
|
48 |
generator = torch.Generator("cuda").manual_seed(seed)
|
49 |
images = pipe(
|
50 |
-
prompt, negative_prompt=negative_prompt, image=
|
51 |
generator=generator,
|
52 |
).images
|
53 |
return images
|
@@ -58,11 +58,11 @@ def process(input_image, prompt, negative_prompt, num_steps, controlnet_conditio
|
|
58 |
# resize input_image to 1024x1024
|
59 |
input_image = resize_image(input_image)
|
60 |
|
61 |
-
|
62 |
|
63 |
-
images = generate_(prompt, negative_prompt,
|
64 |
|
65 |
-
return [
|
66 |
|
67 |
block = gr.Blocks().queue()
|
68 |
|
|
|
44 |
|
45 |
|
46 |
@spaces.GPU
|
47 |
+
def generate_(prompt, negative_prompt, grayscale_image, num_steps, controlnet_conditioning_scale, seed):
|
48 |
generator = torch.Generator("cuda").manual_seed(seed)
|
49 |
images = pipe(
|
50 |
+
prompt, negative_prompt=negative_prompt, image=grayscale_image, num_inference_steps=num_steps, controlnet_conditioning_scale=float(controlnet_conditioning_scale),
|
51 |
generator=generator,
|
52 |
).images
|
53 |
return images
|
|
|
58 |
# resize input_image to 1024x1024
|
59 |
input_image = resize_image(input_image)
|
60 |
|
61 |
+
grayscale_image = input_image.convert('L').convert('RGB')
|
62 |
|
63 |
+
images = generate_(prompt, negative_prompt, grayscale_image, num_steps, controlnet_conditioning_scale, seed)
|
64 |
|
65 |
+
return [grayscale_image,images[0]]
|
66 |
|
67 |
block = gr.Blocks().queue()
|
68 |
|