multimodalart HF staff commited on
Commit
10151ae
1 Parent(s): dc9311b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -204,7 +204,10 @@ def merge_incompatible_lora(full_path_lora, lora_scale):
204
  del weights_sd
205
  del lora_model
206
  @spaces.GPU
207
- def generate_image(prompt, negative, face_emb, face_image, face_kps, image_strength, guidance_scale, face_strength, depth_control_scale, repo_name, loaded_state_dict, lora_scale, sdxl_loras, selected_state_index):
 
 
 
208
  global last_fused, last_lora
209
  print("Last LoRA: ", last_lora)
210
  print("Current LoRA: ", repo_name)
@@ -259,6 +262,7 @@ def generate_image(prompt, negative, face_emb, face_image, face_kps, image_stren
259
  elapsed_time = et - st
260
  print('Prompt processing took: ', elapsed_time, 'seconds')
261
  print("Processing image...")
 
262
  image = pipe(
263
  prompt_embeds=conditioning,
264
  pooled_prompt_embeds=pooled,
@@ -274,6 +278,9 @@ def generate_image(prompt, negative, face_emb, face_image, face_kps, image_stren
274
  guidance_scale = guidance_scale,
275
  controlnet_conditioning_scale=[face_strength, depth_control_scale],
276
  ).images[0]
 
 
 
277
  last_lora = repo_name
278
  return image
279
 
@@ -320,8 +327,9 @@ def run_lora(face_image, prompt, negative, lora_scale, selected_state, face_stre
320
  et = time.time()
321
  elapsed_time = et - st
322
  print('Small content processing took: ', elapsed_time, 'seconds')
323
-
324
- image = generate_image(prompt, negative, face_emb, face_image, face_kps, image_strength, guidance_scale, face_strength, depth_control_scale, repo_name, loaded_state_dict, lora_scale, sdxl_loras, selected_state_index)
 
325
  return image, gr.update(visible=True)
326
 
327
  def shuffle_gallery(sdxl_loras):
 
204
  del weights_sd
205
  del lora_model
206
  @spaces.GPU
207
+ def generate_image(prompt, negative, face_emb, face_image, face_kps, image_strength, guidance_scale, face_strength, depth_control_scale, repo_name, loaded_state_dict, lora_scale, sdxl_loras, selected_state_index, st):
208
+ et = time.time()
209
+ elapsed_time = et - st
210
+ print('Getting into the decorated function took: ', elapsed_time, 'seconds')
211
  global last_fused, last_lora
212
  print("Last LoRA: ", last_lora)
213
  print("Current LoRA: ", repo_name)
 
262
  elapsed_time = et - st
263
  print('Prompt processing took: ', elapsed_time, 'seconds')
264
  print("Processing image...")
265
+ st = time.time()
266
  image = pipe(
267
  prompt_embeds=conditioning,
268
  pooled_prompt_embeds=pooled,
 
278
  guidance_scale = guidance_scale,
279
  controlnet_conditioning_scale=[face_strength, depth_control_scale],
280
  ).images[0]
281
+ et = time.time()
282
+ elapsed_time = et - st
283
+ print('Image processing took: ', elapsed_time, 'seconds')
284
  last_lora = repo_name
285
  return image
286
 
 
327
  et = time.time()
328
  elapsed_time = et - st
329
  print('Small content processing took: ', elapsed_time, 'seconds')
330
+
331
+ st = time.time()
332
+ image = generate_image(prompt, negative, face_emb, face_image, face_kps, image_strength, guidance_scale, face_strength, depth_control_scale, repo_name, loaded_state_dict, lora_scale, sdxl_loras, selected_state_index, st)
333
  return image, gr.update(visible=True)
334
 
335
  def shuffle_gallery(sdxl_loras):