Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,6 @@ import numpy as np
|
|
| 5 |
from PIL import Image
|
| 6 |
from einops import rearrange
|
| 7 |
import requests
|
| 8 |
-
import spaces
|
| 9 |
from diffusers.utils import load_image
|
| 10 |
from diffusers import FluxControlNetPipeline, FluxControlNetModel
|
| 11 |
from gradio_imageslider import ImageSlider
|
|
@@ -34,7 +33,6 @@ def preprocess_image(image, target_width, target_height):
|
|
| 34 |
image = image.resize((target_width, target_height), Image.LANCZOS)
|
| 35 |
return image
|
| 36 |
|
| 37 |
-
@spaces.GPU(duration=120)
|
| 38 |
def generate_image(prompt, control_image, control_mode, controlnet_conditioning_scale, num_steps, guidance, width, height, seed, random_seed):
|
| 39 |
if random_seed:
|
| 40 |
seed = np.random.randint(0, 10000)
|
|
@@ -54,7 +52,7 @@ def generate_image(prompt, control_image, control_mode, controlnet_conditioning_
|
|
| 54 |
image = pipe(
|
| 55 |
prompt,
|
| 56 |
control_image=control_image,
|
| 57 |
-
control_mode=control_mode,
|
| 58 |
width=width,
|
| 59 |
height=height,
|
| 60 |
controlnet_conditioning_scale=controlnet_conditioning_scale,
|
|
|
|
| 5 |
from PIL import Image
|
| 6 |
from einops import rearrange
|
| 7 |
import requests
|
|
|
|
| 8 |
from diffusers.utils import load_image
|
| 9 |
from diffusers import FluxControlNetPipeline, FluxControlNetModel
|
| 10 |
from gradio_imageslider import ImageSlider
|
|
|
|
| 33 |
image = image.resize((target_width, target_height), Image.LANCZOS)
|
| 34 |
return image
|
| 35 |
|
|
|
|
| 36 |
def generate_image(prompt, control_image, control_mode, controlnet_conditioning_scale, num_steps, guidance, width, height, seed, random_seed):
|
| 37 |
if random_seed:
|
| 38 |
seed = np.random.randint(0, 10000)
|
|
|
|
| 52 |
image = pipe(
|
| 53 |
prompt,
|
| 54 |
control_image=control_image,
|
| 55 |
+
control_mode=control_mode, # Pass control mode explicitly
|
| 56 |
width=width,
|
| 57 |
height=height,
|
| 58 |
controlnet_conditioning_scale=controlnet_conditioning_scale,
|