EmanHassan26 commited on
Commit
88d0708
·
verified ·
1 Parent(s): f54dd8e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -159,16 +159,21 @@ def generate_input_image(image_path,input_choice):
159
  print(f"input_choice: '{input_choice}'")
160
  if input_choice == 0 :
161
  conditioning_image = generate_edgeImage(image_path)
162
- pipe = pipe_edge
163
  elif input_choice == 1 :
164
  conditioning_image = generate_segmt_img(image_path)
165
- pipe = pipe_seg
166
  else:
167
  conditioning_image = extract_depth_map(image_path)
168
- pipe = pipe_depth
169
- return conditioning_image, pipe
170
- def generate_output_image(prompt,pipe):
171
  #---------------------
 
 
 
 
 
 
 
172
  pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
173
  pipe.enable_attention_slicing()
174
  #---------------------
@@ -255,7 +260,7 @@ with gr.Blocks() as demo:
255
  )
256
  generate_btn.click(
257
  fn=generate_output_image,
258
- inputs=[prompt_input,pipe],
259
  outputs=[output_image]
260
  )
261
 
 
159
  print(f"input_choice: '{input_choice}'")
160
  if input_choice == 0 :
161
  conditioning_image = generate_edgeImage(image_path)
 
162
  elif input_choice == 1 :
163
  conditioning_image = generate_segmt_img(image_path)
 
164
  else:
165
  conditioning_image = extract_depth_map(image_path)
166
+ return conditioning_image
167
+
168
+ def generate_output_image(prompt,input_choice):
169
  #---------------------
170
+ if input_choice == 0 :
171
+ pipe = pipe_edge
172
+ elif input_choice == 1 :
173
+ pipe = pipe_seg
174
+ else:
175
+ pipe = pipe_depth
176
+
177
  pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
178
  pipe.enable_attention_slicing()
179
  #---------------------
 
260
  )
261
  generate_btn.click(
262
  fn=generate_output_image,
263
+ inputs=[prompt_input,image_dropdown],
264
  outputs=[output_image]
265
  )
266