Spaces:
Build error
Build error
Moibe
commited on
Commit
·
a781931
1
Parent(s):
1920c57
Se agregó selector de procesador
Browse files
app.py
CHANGED
|
@@ -23,23 +23,38 @@ def save_images_as_zip(path_foto, filename, plataforma):
|
|
| 23 |
ruta = os.path.basename(path_foto_zippable)
|
| 24 |
zip_file.write(path_foto_zippable, ruta)
|
| 25 |
|
| 26 |
-
def
|
| 27 |
|
| 28 |
modo = "video"
|
| 29 |
#local o huggingface
|
| 30 |
plataforma = "huggingface"
|
|
|
|
| 31 |
#face_swapper o face_enhancer o la combinación de ellos.
|
|
|
|
| 32 |
procesador = "face_swapper"
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
print("Inicio: Estamos en modo ", modo)
|
| 35 |
print("Estamos en la plataforma:", plataforma)
|
| 36 |
print("El procesador es: ", procesador)
|
| 37 |
|
| 38 |
-
print("Input1:")
|
| 39 |
-
print(input1)
|
| 40 |
-
print("Input2:")
|
| 41 |
-
print(input2)
|
| 42 |
-
|
| 43 |
path_video = input2
|
| 44 |
|
| 45 |
if plataforma == "local":
|
|
@@ -192,6 +207,6 @@ def greet(input1, input2):
|
|
| 192 |
|
| 193 |
#1 output: video.
|
| 194 |
demo = gr.Interface(
|
| 195 |
-
fn=
|
| 196 |
)
|
| 197 |
demo.launch()
|
|
|
|
| 23 |
ruta = os.path.basename(path_foto_zippable)
|
| 24 |
zip_file.write(path_foto_zippable, ruta)
|
| 25 |
|
| 26 |
+
def perform(input1, input2, input3):
|
| 27 |
|
| 28 |
modo = "video"
|
| 29 |
#local o huggingface
|
| 30 |
plataforma = "huggingface"
|
| 31 |
+
|
| 32 |
#face_swapper o face_enhancer o la combinación de ellos.
|
| 33 |
+
#El default, por si el usuario no eligiera nada, es:
|
| 34 |
procesador = "face_swapper"
|
| 35 |
+
print("Por ahora el procesador es:", procesador)
|
| 36 |
+
|
| 37 |
+
print("Esto fue el input 3 recibido...:", input3)
|
| 38 |
+
time.sleep(3)
|
| 39 |
+
|
| 40 |
+
longitud = len(input3)
|
| 41 |
+
|
| 42 |
+
print(f"El arreglo tiene {longitud} elementos")
|
| 43 |
+
time.sleep(3)
|
| 44 |
+
|
| 45 |
+
if longitud == 2:
|
| 46 |
+
procesador = "face_swapper face_enhancer"
|
| 47 |
+
elif longitud == 0:
|
| 48 |
+
print("La longitud si da 0")
|
| 49 |
+
else:
|
| 50 |
+
procesador = input3[0]
|
| 51 |
+
|
| 52 |
+
print("El procesador seleccionado terminó siendo...", procesador)
|
| 53 |
+
|
| 54 |
print("Inicio: Estamos en modo ", modo)
|
| 55 |
print("Estamos en la plataforma:", plataforma)
|
| 56 |
print("El procesador es: ", procesador)
|
| 57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
path_video = input2
|
| 59 |
|
| 60 |
if plataforma == "local":
|
|
|
|
| 207 |
|
| 208 |
#1 output: video.
|
| 209 |
demo = gr.Interface(
|
| 210 |
+
fn=perform, inputs=[gr.Image(), gr.Video(), gr.CheckboxGroup(["face_swapper","face_enhancer"], label="Processor")], outputs=[gr.Video()]
|
| 211 |
)
|
| 212 |
demo.launch()
|