multimodalart HF staff commited on
Commit
560d75d
β€’
1 Parent(s): 74395e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -15
app.py CHANGED
@@ -90,9 +90,9 @@ hf_hub_download(
90
  local_dir="/data/checkpoints",
91
  )
92
  # download antelopev2
93
- gdown.download(url="https://drive.google.com/file/d/18wEUfMNohBJ4K3Ly5wpTejPfDzp-8fI8/view?usp=sharing", output="/data/", quiet=False, fuzzy=True)
94
- # unzip antelopev2.zip
95
- os.system("unzip /data/antelopev2.zip -d /data/models/")
96
 
97
  app = FaceAnalysis(name='antelopev2', root='/data', providers=['CPUExecutionProvider'])
98
  app.prepare(ctx_id=0, det_size=(640, 640))
@@ -432,17 +432,18 @@ with gr.Blocks(css="custom.css") as demo:
432
  queue=False,
433
  show_progress=False
434
  )
435
- prompt.submit(
436
- fn=check_selected,
437
- inputs=[selected_state],
438
- queue=False,
439
- show_progress=False
440
- ).success(
441
  fn=center_crop_image_as_square,
442
  inputs=[photo],
443
  outputs=[photo],
444
  queue=False,
445
  show_progress=False,
 
 
 
 
 
 
446
  ).success(
447
  fn=run_lora,
448
  inputs=[photo, prompt, negative, weight, selected_state, face_strength, image_strength, guidance_scale, depth_control_scale, gr_sdxl_loras, gr_sdxl_loras_new],
@@ -453,12 +454,6 @@ with gr.Blocks(css="custom.css") as demo:
453
  inputs=[selected_state],
454
  queue=False,
455
  show_progress=False
456
- ).success(
457
- fn=center_crop_image_as_square,
458
- inputs=[photo],
459
- outputs=[photo],
460
- queue=False,
461
- show_progress=False,
462
  ).success(
463
  fn=run_lora,
464
  inputs=[photo, prompt, negative, weight, selected_state, face_strength, image_strength, guidance_scale, depth_control_scale, gr_sdxl_loras, gr_sdxl_loras_new],
 
90
  local_dir="/data/checkpoints",
91
  )
92
  # download antelopev2
93
+ if not os.path.exists("/data/models/scrfd_10g_bnkps.onnx"):
94
+ gdown.download(url="https://drive.google.com/file/d/18wEUfMNohBJ4K3Ly5wpTejPfDzp-8fI8/view?usp=sharing", output="/data/", quiet=False, fuzzy=True)
95
+ os.system("unzip /data/antelopev2.zip -d /data/models/")
96
 
97
  app = FaceAnalysis(name='antelopev2', root='/data', providers=['CPUExecutionProvider'])
98
  app.prepare(ctx_id=0, det_size=(640, 640))
 
432
  queue=False,
433
  show_progress=False
434
  )
435
+ photo.upload(
 
 
 
 
 
436
  fn=center_crop_image_as_square,
437
  inputs=[photo],
438
  outputs=[photo],
439
  queue=False,
440
  show_progress=False,
441
+ )
442
+ prompt.submit(
443
+ fn=check_selected,
444
+ inputs=[selected_state],
445
+ queue=False,
446
+ show_progress=False
447
  ).success(
448
  fn=run_lora,
449
  inputs=[photo, prompt, negative, weight, selected_state, face_strength, image_strength, guidance_scale, depth_control_scale, gr_sdxl_loras, gr_sdxl_loras_new],
 
454
  inputs=[selected_state],
455
  queue=False,
456
  show_progress=False
 
 
 
 
 
 
457
  ).success(
458
  fn=run_lora,
459
  inputs=[photo, prompt, negative, weight, selected_state, face_strength, image_strength, guidance_scale, depth_control_scale, gr_sdxl_loras, gr_sdxl_loras_new],