Spaces:
Running
Running
gavinyuan
commited on
Commit
·
5089b6a
1
Parent(s):
d25d54e
update: app.py
Browse files
app.py
CHANGED
|
@@ -341,7 +341,7 @@ def process_video(
|
|
| 341 |
return targets, t_facial_masks, Ms, original_frames, names, fps
|
| 342 |
|
| 343 |
|
| 344 |
-
def swap_image_gr(img1, img2, use_post=False, use_gpen=False,
|
| 345 |
root_dir = make_abs_path("./online_data")
|
| 346 |
req_id = uuid.uuid1().hex
|
| 347 |
data_dir = os.path.join(root_dir, req_id)
|
|
@@ -369,7 +369,7 @@ def swap_image_gr(img1, img2, use_post=False, use_gpen=False, gpu_mode=True):
|
|
| 369 |
return out
|
| 370 |
|
| 371 |
|
| 372 |
-
def swap_video_gr(img1, target_path,
|
| 373 |
root_dir = make_abs_path("./online_data")
|
| 374 |
req_id = uuid.uuid1().hex
|
| 375 |
data_dir = os.path.join(root_dir, req_id)
|
|
@@ -460,12 +460,12 @@ if __name__ == "__main__":
|
|
| 460 |
video_button = gr.Button("换脸")
|
| 461 |
image_button.click(
|
| 462 |
swap_image_gr,
|
| 463 |
-
inputs=[image1_input, image2_input, use_post, use_gpen
|
| 464 |
outputs=image_output,
|
| 465 |
)
|
| 466 |
video_button.click(
|
| 467 |
swap_video_gr,
|
| 468 |
-
inputs=[image3_input, video_input
|
| 469 |
outputs=video_output,
|
| 470 |
)
|
| 471 |
|
|
|
|
| 341 |
return targets, t_facial_masks, Ms, original_frames, names, fps
|
| 342 |
|
| 343 |
|
| 344 |
+
def swap_image_gr(img1, img2, use_post=False, use_gpen=False, ):
|
| 345 |
root_dir = make_abs_path("./online_data")
|
| 346 |
req_id = uuid.uuid1().hex
|
| 347 |
data_dir = os.path.join(root_dir, req_id)
|
|
|
|
| 369 |
return out
|
| 370 |
|
| 371 |
|
| 372 |
+
def swap_video_gr(img1, target_path, frames=9999999):
|
| 373 |
root_dir = make_abs_path("./online_data")
|
| 374 |
req_id = uuid.uuid1().hex
|
| 375 |
data_dir = os.path.join(root_dir, req_id)
|
|
|
|
| 460 |
video_button = gr.Button("换脸")
|
| 461 |
image_button.click(
|
| 462 |
swap_image_gr,
|
| 463 |
+
inputs=[image1_input, image2_input, use_post, use_gpen],
|
| 464 |
outputs=image_output,
|
| 465 |
)
|
| 466 |
video_button.click(
|
| 467 |
swap_video_gr,
|
| 468 |
+
inputs=[image3_input, video_input],
|
| 469 |
outputs=video_output,
|
| 470 |
)
|
| 471 |
|