|
import gradio as gr |
|
import subprocess |
|
import shutil |
|
import os |
|
|
|
def run_scripts(target, source, use_face_enhancer): |
|
outputfile=[] |
|
for target_file in target : |
|
target_extension = os.path.splitext(target_file.name)[-1] |
|
|
|
output_path1 = target_file |
|
cmd1 = ["python3", "run.py", "-s", source.name, "-t", target_file.name, "-o", output_path1, "--frame-processor", "face_swapper","face_enhancer"] |
|
subprocess.run(cmd1) |
|
outputfile.append(output_path1) |
|
|
|
return outputfile |
|
|
|
iface = gr.Interface( |
|
fn=run_scripts, |
|
inputs=[ |
|
"files", |
|
"file", |
|
gr.inputs.Checkbox(default=False, label="Use only Face Enhancer") |
|
], |
|
outputs="files", |
|
title="Face swapper", |
|
description="Upload a target image/video and a source image to swap faces.", |
|
live=False |
|
) |
|
|
|
iface.launch() |
|
|