import gradio as gr import os from run import run_faceswap def process_face_swap(source_image, target_media): source_path = "face.png" target_path = "target" source_image.save(source_path) ext = os.path.splitext(target_media.name)[-1] target_path += ext target_media.save(target_path) output_path = run_faceswap(source_path, target_path) return output_path iface = gr.Interface( fn=process_face_swap, inputs=[ gr.Image(label="Source Face (face.png)"), gr.File(label="Target Image or Video (.jpg/.mp4)") ], outputs=gr.File(label="Swapped Output"), title="Lightweight Roop Face Swap", description="Upload face.png and target image/video. Output will be result.jpg or result.mp4" ) iface.launch()