File size: 505 Bytes
f41084f
 
ee2deb7
f41084f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
import subprocess

# 运行 Face Swap 代码
def run_script(source_video, target_face):
    cmd = f"python inference.py --source {source_video} --target {target_face}"
    result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
    return result.stdout

# Gradio UI
iface = gr.Interface(
    fn=run_script,
    inputs=["file", "file"],
    outputs="text",
    title="Video Face Swap",
    description="Upload a video and a face image to swap faces."
)

iface.launch()