Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -36,6 +36,7 @@ pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
|
|
| 36 |
|
| 37 |
pipe.to(device)
|
| 38 |
|
|
|
|
| 39 |
# 📸 Edge detection function using OpenCV (Canny)
|
| 40 |
@spaces.GPU
|
| 41 |
def apply_canny(image, low_threshold, high_threshold):
|
|
@@ -45,6 +46,7 @@ def apply_canny(image, low_threshold, high_threshold):
|
|
| 45 |
image = np.concatenate([image, image, image], axis=2)
|
| 46 |
return Image.fromarray(image)
|
| 47 |
|
|
|
|
| 48 |
# 🎨 Image generation function from image
|
| 49 |
@spaces.GPU
|
| 50 |
def generate_image(prompt, input_image, low_threshold, high_threshold, strength, guidance, controlnet_conditioning_scale):
|
|
@@ -64,6 +66,7 @@ def generate_image(prompt, input_image, low_threshold, high_threshold, strength,
|
|
| 64 |
|
| 65 |
return edge_detected, result
|
| 66 |
|
|
|
|
| 67 |
# 🎨 Image generation function from prompt
|
| 68 |
@spaces.GPU
|
| 69 |
def generate_prompt(prompt, strength, guidance):
|
|
@@ -111,8 +114,8 @@ with gr.Blocks() as demo:
|
|
| 111 |
)
|
| 112 |
|
| 113 |
generate_prompt_button.click(
|
| 114 |
-
fn=
|
| 115 |
-
inputs=[prompt,
|
| 116 |
outputs=[result_output]
|
| 117 |
)
|
| 118 |
|
|
|
|
| 36 |
|
| 37 |
pipe.to(device)
|
| 38 |
|
| 39 |
+
|
| 40 |
# 📸 Edge detection function using OpenCV (Canny)
|
| 41 |
@spaces.GPU
|
| 42 |
def apply_canny(image, low_threshold, high_threshold):
|
|
|
|
| 46 |
image = np.concatenate([image, image, image], axis=2)
|
| 47 |
return Image.fromarray(image)
|
| 48 |
|
| 49 |
+
|
| 50 |
# 🎨 Image generation function from image
|
| 51 |
@spaces.GPU
|
| 52 |
def generate_image(prompt, input_image, low_threshold, high_threshold, strength, guidance, controlnet_conditioning_scale):
|
|
|
|
| 66 |
|
| 67 |
return edge_detected, result
|
| 68 |
|
| 69 |
+
|
| 70 |
# 🎨 Image generation function from prompt
|
| 71 |
@spaces.GPU
|
| 72 |
def generate_prompt(prompt, strength, guidance):
|
|
|
|
| 114 |
)
|
| 115 |
|
| 116 |
generate_prompt_button.click(
|
| 117 |
+
fn=generate_prompt,
|
| 118 |
+
inputs=[prompt, strength, guidance],
|
| 119 |
outputs=[result_output]
|
| 120 |
)
|
| 121 |
|