Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -52,7 +52,10 @@ def preprocess_canny_image(image, width=1024, height=1024):
|
|
52 |
return image
|
53 |
|
54 |
@spaces.GPU()
|
55 |
-
def generate_image(prompt, control_image, num_steps=50, guidance=4, width=512, height=512, seed=42):
|
|
|
|
|
|
|
56 |
if not os.path.isdir("./controlnet_results/"):
|
57 |
os.makedirs("./controlnet_results/")
|
58 |
|
@@ -97,7 +100,8 @@ interface = gr.Interface(
|
|
97 |
gr.Slider(minimum=0.1, maximum=10, value=4, label="Guidance"),
|
98 |
gr.Slider(minimum=128, maximum=2048, step=128, value=1024, label="Width"),
|
99 |
gr.Slider(minimum=128, maximum=2048, step=128, value=1024, label="Height"),
|
100 |
-
gr.Number(value=42, label="Seed")
|
|
|
101 |
],
|
102 |
outputs=gr.Image(type="pil", label="Generated Image"),
|
103 |
title="FLUX.1 Controlnet Cany",
|
@@ -105,4 +109,5 @@ interface = gr.Interface(
|
|
105 |
)
|
106 |
|
107 |
if __name__ == "__main__":
|
108 |
-
interface.launch()
|
|
|
|
52 |
return image
|
53 |
|
54 |
@spaces.GPU()
|
55 |
+
def generate_image(prompt, control_image, num_steps=50, guidance=4, width=512, height=512, seed=42, random_seed=False):
|
56 |
+
if random_seed:
|
57 |
+
seed = np.random.randint(0, 10000)
|
58 |
+
|
59 |
if not os.path.isdir("./controlnet_results/"):
|
60 |
os.makedirs("./controlnet_results/")
|
61 |
|
|
|
100 |
gr.Slider(minimum=0.1, maximum=10, value=4, label="Guidance"),
|
101 |
gr.Slider(minimum=128, maximum=2048, step=128, value=1024, label="Width"),
|
102 |
gr.Slider(minimum=128, maximum=2048, step=128, value=1024, label="Height"),
|
103 |
+
gr.Number(value=42, label="Seed"),
|
104 |
+
gr.Checkbox(label="Random Seed")
|
105 |
],
|
106 |
outputs=gr.Image(type="pil", label="Generated Image"),
|
107 |
title="FLUX.1 Controlnet Cany",
|
|
|
109 |
)
|
110 |
|
111 |
if __name__ == "__main__":
|
112 |
+
interface.launch()
|
113 |
+
|