Update app.py
Browse files
app.py
CHANGED
|
@@ -28,7 +28,7 @@ def face_swap_batch(rb_img, lote_imgs):
|
|
| 28 |
for i, file in enumerate(lote_imgs):
|
| 29 |
name = f"img_{i}.jpg"
|
| 30 |
path = os.path.join(INPUT_DIR, name)
|
| 31 |
-
img = Image.open(file) #
|
| 32 |
img.save(path)
|
| 33 |
img_paths.append(path)
|
| 34 |
|
|
@@ -45,7 +45,7 @@ def face_swap_batch(rb_img, lote_imgs):
|
|
| 45 |
"--frame-processor", "face_swapper", "face_enhancer"
|
| 46 |
])
|
| 47 |
|
| 48 |
-
#
|
| 49 |
resultados = []
|
| 50 |
for path in img_paths:
|
| 51 |
filename = os.path.basename(path)
|
|
@@ -53,7 +53,7 @@ def face_swap_batch(rb_img, lote_imgs):
|
|
| 53 |
if os.path.exists(generado_path):
|
| 54 |
resultados.append(generado_path)
|
| 55 |
|
| 56 |
-
#
|
| 57 |
if len(resultados) == 1:
|
| 58 |
return resultados[0]
|
| 59 |
else:
|
|
@@ -72,5 +72,5 @@ gr.Interface(
|
|
| 72 |
],
|
| 73 |
outputs=gr.File(label="📦 Descargar resultado"),
|
| 74 |
title="Deep Fake Lote - Yepo Hz",
|
| 75 |
-
description="Sube una imagen de rostro base y varias imágenes objetivo. El sistema aplicará el cambio de rostro en lote y
|
| 76 |
).launch()
|
|
|
|
| 28 |
for i, file in enumerate(lote_imgs):
|
| 29 |
name = f"img_{i}.jpg"
|
| 30 |
path = os.path.join(INPUT_DIR, name)
|
| 31 |
+
img = Image.open(file) # NamedString → PIL
|
| 32 |
img.save(path)
|
| 33 |
img_paths.append(path)
|
| 34 |
|
|
|
|
| 45 |
"--frame-processor", "face_swapper", "face_enhancer"
|
| 46 |
])
|
| 47 |
|
| 48 |
+
# Recolectar resultados finales
|
| 49 |
resultados = []
|
| 50 |
for path in img_paths:
|
| 51 |
filename = os.path.basename(path)
|
|
|
|
| 53 |
if os.path.exists(generado_path):
|
| 54 |
resultados.append(generado_path)
|
| 55 |
|
| 56 |
+
# Entregar como imagen o ZIP
|
| 57 |
if len(resultados) == 1:
|
| 58 |
return resultados[0]
|
| 59 |
else:
|
|
|
|
| 72 |
],
|
| 73 |
outputs=gr.File(label="📦 Descargar resultado"),
|
| 74 |
title="Deep Fake Lote - Yepo Hz",
|
| 75 |
+
description="Sube una imagen de rostro base y varias imágenes objetivo. El sistema aplicará el cambio de rostro en lote y devolverá imágenes procesadas (mejoradas)."
|
| 76 |
).launch()
|