YepoHz commited on
Commit
f458279
verified
1 Parent(s): 5ac0fe4

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -56
app.py DELETED
@@ -1,56 +0,0 @@
1
-
2
- import gradio as gr
3
- import os
4
- import shutil
5
- import subprocess
6
-
7
- # === Descarga y configuraci贸n de Roop ===
8
- if not os.path.exists("roop"):
9
- subprocess.run(["git", "clone", "https://github.com/s0md3v/roop.git"])
10
- os.chdir("roop")
11
-
12
- subprocess.run(["pip", "uninstall", "-y", "jax", "jaxlib", "numpy", "tensorflow"])
13
- subprocess.run(["pip", "install", "numpy==1.23.5", "jax==0.4.13", "jaxlib==0.4.13", "tensorflow==2.12.0"])
14
- subprocess.run(["pip", "install", "-r", "requirements.txt"])
15
-
16
- os.chdir("..")
17
-
18
- def procesar_lote(img_rostro, imgs_objetivo):
19
- input_dir = "roop/batch_input"
20
- output_dir = "roop/batch_output"
21
-
22
- shutil.rmtree(input_dir, ignore_errors=True)
23
- shutil.rmtree(output_dir, ignore_errors=True)
24
- os.makedirs(input_dir, exist_ok=True)
25
- os.makedirs(output_dir, exist_ok=True)
26
-
27
- rostro_path = os.path.join("roop", "RB.jpg")
28
- img_rostro.save(rostro_path)
29
-
30
- for img in imgs_objetivo:
31
- img.save(os.path.join(input_dir, img.name))
32
-
33
- comando = [
34
- "python", "roop/run.py",
35
- "--source_face", rostro_path,
36
- "--target_folder", input_dir,
37
- "--output_folder", output_dir,
38
- "--frame-processor", "face_swapper"
39
- ]
40
- subprocess.run(comando)
41
-
42
- zip_path = "roop/resultado.zip"
43
- shutil.make_archive(zip_path.replace(".zip", ""), 'zip', output_dir)
44
-
45
- return zip_path
46
-
47
- gr.Interface(
48
- fn=procesar_lote,
49
- inputs=[
50
- gr.Image(label="Rostro base (RB.jpg)", type="pil"),
51
- gr.File(file_types=["image"], label="Im谩genes a procesar", file_count="multiple")
52
- ],
53
- outputs=gr.File(label="Descargar resultados ZIP"),
54
- title="Intercambio de rostros por lote con Roop",
55
- description="Sube una imagen de rostro base y varias im谩genes objetivo. El sistema procesar谩 todas y devolver谩 un ZIP con los resultados.",
56
- ).launch()