Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
|
| 2 |
import torch
|
| 3 |
from diffusers.utils import load_image
|
| 4 |
from diffusers import FluxControlNetPipeline, FluxControlNetModel, FluxMultiControlNetModel
|
|
@@ -25,18 +24,18 @@ control_modes = [
|
|
| 25 |
]
|
| 26 |
|
| 27 |
@spaces.GPU
|
| 28 |
-
def generate_image(prompt, control_image_depth,
|
| 29 |
control_images = []
|
| 30 |
control_modes = []
|
| 31 |
conditioning_scales = []
|
| 32 |
|
| 33 |
if use_depth:
|
| 34 |
control_images.append(control_image_depth)
|
| 35 |
-
control_modes.append(
|
| 36 |
conditioning_scales.append(0.2)
|
| 37 |
|
| 38 |
control_images.append(control_image_canny)
|
| 39 |
-
control_modes.append(
|
| 40 |
conditioning_scales.append(0.4)
|
| 41 |
|
| 42 |
width, height = control_image_canny.size
|
|
@@ -60,10 +59,10 @@ iface = gr.Interface(
|
|
| 60 |
inputs=[
|
| 61 |
gr.Text(label="Prompt"),
|
| 62 |
gr.Image(label="Control Image (Depth)"),
|
| 63 |
-
gr.Dropdown(choices=control_modes, value="depth", label="Control Mode (Depth)"),
|
| 64 |
gr.Checkbox(label="Use Depth Control Image", value=True),
|
| 65 |
gr.Image(label="Control Image (Canny)"),
|
| 66 |
-
gr.Dropdown(choices=control_modes, value="canny", label="Control Mode (Canny)")
|
| 67 |
],
|
| 68 |
outputs=gr.Image(label="Generated Image"),
|
| 69 |
title="FluxControlNet Image Generation",
|
|
|
|
|
|
|
| 1 |
import torch
|
| 2 |
from diffusers.utils import load_image
|
| 3 |
from diffusers import FluxControlNetPipeline, FluxControlNetModel, FluxMultiControlNetModel
|
|
|
|
| 24 |
]
|
| 25 |
|
| 26 |
@spaces.GPU
|
| 27 |
+
def generate_image(prompt, control_image_depth, control_mode_depth_index, use_depth, control_image_canny, control_mode_canny_index):
|
| 28 |
control_images = []
|
| 29 |
control_modes = []
|
| 30 |
conditioning_scales = []
|
| 31 |
|
| 32 |
if use_depth:
|
| 33 |
control_images.append(control_image_depth)
|
| 34 |
+
control_modes.append(control_mode_depth_index)
|
| 35 |
conditioning_scales.append(0.2)
|
| 36 |
|
| 37 |
control_images.append(control_image_canny)
|
| 38 |
+
control_modes.append(control_mode_canny_index)
|
| 39 |
conditioning_scales.append(0.4)
|
| 40 |
|
| 41 |
width, height = control_image_canny.size
|
|
|
|
| 59 |
inputs=[
|
| 60 |
gr.Text(label="Prompt"),
|
| 61 |
gr.Image(label="Control Image (Depth)"),
|
| 62 |
+
gr.Dropdown(choices=list(range(len(control_modes))), value=control_modes.index("depth"), label="Control Mode (Depth)"),
|
| 63 |
gr.Checkbox(label="Use Depth Control Image", value=True),
|
| 64 |
gr.Image(label="Control Image (Canny)"),
|
| 65 |
+
gr.Dropdown(choices=list(range(len(control_modes))), value=control_modes.index("canny"), label="Control Mode (Canny)")
|
| 66 |
],
|
| 67 |
outputs=gr.Image(label="Generated Image"),
|
| 68 |
title="FluxControlNet Image Generation",
|