Spaces:
Running
on
Zero
Running
on
Zero
Update raw.py
Browse files
raw.py
CHANGED
|
@@ -23,7 +23,7 @@ pipe = FluxControlNetPipeline.from_pretrained(
|
|
| 23 |
pipe.to("cuda")
|
| 24 |
|
| 25 |
@spaces.GPU
|
| 26 |
-
def generate_image(prompt, scale, steps, control_image):
|
| 27 |
# Load control image
|
| 28 |
control_image = load_image(control_image)
|
| 29 |
w, h = control_image.size
|
|
@@ -33,9 +33,9 @@ def generate_image(prompt, scale, steps, control_image):
|
|
| 33 |
image = pipe(
|
| 34 |
prompt=prompt,
|
| 35 |
control_image=control_image,
|
| 36 |
-
controlnet_conditioning_scale=
|
| 37 |
num_inference_steps=steps,
|
| 38 |
-
guidance_scale=
|
| 39 |
height=control_image.size[1],
|
| 40 |
width=control_image.size[0]
|
| 41 |
).images[0]
|
|
@@ -49,6 +49,8 @@ iface = gr.Interface(
|
|
| 49 |
gr.Slider(1, 3, value=1, label="Scale"),
|
| 50 |
gr.Slider(6, 30, value=8, label="Steps"),
|
| 51 |
gr.Image(type="pil", label="Control Image"),
|
|
|
|
|
|
|
| 52 |
],
|
| 53 |
outputs=[
|
| 54 |
gr.Image(type="pil", label="Generated Image", format="png"),
|
|
|
|
| 23 |
pipe.to("cuda")
|
| 24 |
|
| 25 |
@spaces.GPU
|
| 26 |
+
def generate_image(prompt, scale, steps, control_image, controlnet_conditioning_scale, guidance_scale):
|
| 27 |
# Load control image
|
| 28 |
control_image = load_image(control_image)
|
| 29 |
w, h = control_image.size
|
|
|
|
| 33 |
image = pipe(
|
| 34 |
prompt=prompt,
|
| 35 |
control_image=control_image,
|
| 36 |
+
controlnet_conditioning_scale=controlnet_conditioning_scale,
|
| 37 |
num_inference_steps=steps,
|
| 38 |
+
guidance_scale=guidance_scale,
|
| 39 |
height=control_image.size[1],
|
| 40 |
width=control_image.size[0]
|
| 41 |
).images[0]
|
|
|
|
| 49 |
gr.Slider(1, 3, value=1, label="Scale"),
|
| 50 |
gr.Slider(6, 30, value=8, label="Steps"),
|
| 51 |
gr.Image(type="pil", label="Control Image"),
|
| 52 |
+
gr.Slider(0, 1, value=0.6, label="ControlNet Scale"),
|
| 53 |
+
gr.Slider(1, 20, value=3.5, label="Guidance Scale"),
|
| 54 |
],
|
| 55 |
outputs=[
|
| 56 |
gr.Image(type="pil", label="Generated Image", format="png"),
|