ar0551 commited on
Commit
0abaf64
·
verified ·
1 Parent(s): 634016d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -26
app.py CHANGED
@@ -87,32 +87,20 @@ def generate_image(prompt, input_image, low_threshold, high_threshold, strength,
87
 
88
  print(pipe.get_active_adapters())
89
 
90
- ## execute if an image is provided
91
- if not isinstance(input_image, type(None)):
92
- # Apply edge detection
93
- edge_detected = apply_canny(input_image, low_threshold, high_threshold)
94
-
95
- # Generate styled image using ControlNet
96
- result = pipe(
97
- prompt=prompt,
98
- image=edge_detected,
99
- num_inference_steps=30,
100
- guidance_scale=guidance,
101
- controlnet_conditioning_scale=float(controlnet_conditioning_scale),
102
- strength=strength
103
- ).images[0]
104
-
105
- return edge_detected, result
106
-
107
- else:
108
- # Generate styled image using ControlNet
109
- result = pipe(
110
- prompt=prompt,
111
- num_inference_steps=30,
112
- guidance_scale=guidance
113
- ).images[0]
114
-
115
- return None, result
116
 
117
  # 🖥️ Gradio UI
118
  with gr.Blocks() as demo:
 
87
 
88
  print(pipe.get_active_adapters())
89
 
90
+ # Apply edge detection
91
+ edge_detected = apply_canny(input_image, low_threshold, high_threshold)
92
+
93
+ # Generate styled image using ControlNet
94
+ result = pipe(
95
+ prompt=prompt,
96
+ image=edge_detected,
97
+ num_inference_steps=30,
98
+ guidance_scale=guidance,
99
+ controlnet_conditioning_scale=float(controlnet_conditioning_scale),
100
+ strength=strength
101
+ ).images[0]
102
+
103
+ return edge_detected, result
 
 
 
 
 
 
 
 
 
 
 
 
104
 
105
  # 🖥️ Gradio UI
106
  with gr.Blocks() as demo: