simswapNSCR / app.py
NeoSerge's picture
Upload app.py
7efbbb9 verified
raw
history blame contribute delete
794 Bytes
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()