File size: 794 Bytes
7efbbb9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import gradio as gr
from run_faceswap import run_faceswap
import os
import uuid

def process_swap(base_image, face_image):
    output_filename = f"result_{uuid.uuid4().hex}.png"
    output_path = os.path.join("outputs", output_filename)
    os.makedirs("outputs", exist_ok=True)

    run_faceswap(base_image, face_image, output_path)

    return output_path

demo = gr.Interface(
    fn=process_swap,
    inputs=[
        gr.Image(type="filepath", label="Imagen Base (cuerpo y fondo)"),
        gr.Image(type="filepath", label="Imagen con el rostro"),
    ],
    outputs=gr.Image(type="filepath", label="Resultado"),
    title="SimSwap desde Hugging Face",
    description="Sube una imagen base y una con el rostro para hacer el cambio de cara."
)

if __name__ == "__main__":
    demo.launch()