MagicFaceLab commited on
Commit
f41084f
·
verified ·
1 Parent(s): f05b2f6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -6
app.py CHANGED
@@ -1,7 +1,19 @@
1
- import os
 
2
 
3
- # 直接运行 main.py(如果 main.py 是主脚本)
4
- if os.path.exists("main.py"):
5
- os.system("python main.py")
6
- else:
7
- print("Error: main.py not found. Please check your project structure.")
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import subprocess
3
 
4
+ # 运行 Face Swap 代码
5
+ def run_script(source_video, target_face):
6
+ cmd = f"python inference.py --source {source_video} --target {target_face}"
7
+ result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
8
+ return result.stdout
9
+
10
+ # Gradio UI
11
+ iface = gr.Interface(
12
+ fn=run_script,
13
+ inputs=["file", "file"],
14
+ outputs="text",
15
+ title="Video Face Swap",
16
+ description="Upload a video and a face image to swap faces."
17
+ )
18
+
19
+ iface.launch()