Spaces:
Running
on
Zero
Running
on
Zero
Update raw.py
Browse files
raw.py
CHANGED
|
@@ -20,17 +20,17 @@ pipe = FluxControlNetPipeline.from_pretrained(
|
|
| 20 |
pipe.to("cuda")
|
| 21 |
|
| 22 |
@spaces.GPU
|
| 23 |
-
def generate_image(prompt, control_image):
|
| 24 |
# Load control image
|
| 25 |
control_image = load_image(control_image)
|
| 26 |
w, h = control_image.size
|
| 27 |
# Upscale x1
|
| 28 |
-
control_image = control_image.resize((w *
|
| 29 |
image = pipe(
|
| 30 |
prompt=prompt,
|
| 31 |
control_image=control_image,
|
| 32 |
controlnet_conditioning_scale=0.6,
|
| 33 |
-
num_inference_steps=
|
| 34 |
guidance_scale=3.5,
|
| 35 |
height=control_image.size[1],
|
| 36 |
width=control_image.size[0]
|
|
@@ -42,6 +42,8 @@ iface = gr.Interface(
|
|
| 42 |
fn=generate_image,
|
| 43 |
inputs=[
|
| 44 |
gr.Textbox(lines=2, placeholder="Enter your prompt here..."),
|
|
|
|
|
|
|
| 45 |
gr.Image(type="pil", label="Control Image"),
|
| 46 |
],
|
| 47 |
outputs=[
|
|
|
|
| 20 |
pipe.to("cuda")
|
| 21 |
|
| 22 |
@spaces.GPU
|
| 23 |
+
def generate_image(prompt, scale, steps, control_image):
|
| 24 |
# Load control image
|
| 25 |
control_image = load_image(control_image)
|
| 26 |
w, h = control_image.size
|
| 27 |
# Upscale x1
|
| 28 |
+
control_image = control_image.resize((w * scale, h * scale))
|
| 29 |
image = pipe(
|
| 30 |
prompt=prompt,
|
| 31 |
control_image=control_image,
|
| 32 |
controlnet_conditioning_scale=0.6,
|
| 33 |
+
num_inference_steps=steps,
|
| 34 |
guidance_scale=3.5,
|
| 35 |
height=control_image.size[1],
|
| 36 |
width=control_image.size[0]
|
|
|
|
| 42 |
fn=generate_image,
|
| 43 |
inputs=[
|
| 44 |
gr.Textbox(lines=2, placeholder="Enter your prompt here..."),
|
| 45 |
+
gr.Slider(1, 3, value=1, label="Scale"),
|
| 46 |
+
gr.Slider(6, 30, value=8, label="Steps"),
|
| 47 |
gr.Image(type="pil", label="Control Image"),
|
| 48 |
],
|
| 49 |
outputs=[
|