Moibe commited on
Commit
7310428
1 Parent(s): cbc245c

Perfected version

Browse files
Files changed (3) hide show
  1. .gitignore +5 -0
  2. adios.py +0 -0
  3. app.py +14 -3
.gitignore CHANGED
@@ -1,3 +1,8 @@
 
 
 
 
 
1
  inswapper_128.onnx
2
 
3
  .idea
 
1
+ input.jpg
2
+ result.jpg
3
+ target.jpg
4
+
5
+
6
  inswapper_128.onnx
7
 
8
  .idea
adios.py DELETED
File without changes
app.py CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
2
  from PIL import Image
3
  import time
4
  import os
 
5
 
6
  #Greet es una función de ejemplo para usar.
7
  def greet(input1, input2):
@@ -18,6 +19,7 @@ def greet(input1, input2):
18
 
19
  source_path = "input.jpg"
20
  target_path = "target.jpg"
 
21
 
22
  source_image = Image.fromarray(input1)
23
  print("Esto es source_image: ", source_image)
@@ -29,16 +31,25 @@ def greet(input1, input2):
29
  print("source_path: ", source_path)
30
  print("target_path: ", target_path)
31
 
32
- command = "python hola.py -t" + source_path
 
 
 
 
 
33
  print(command)
34
  time.sleep(1)
35
  proc = os.popen(command)
36
  output = proc.read()
37
 
 
 
38
  print(output)
 
39
 
40
-
41
- return input2
 
42
 
43
  #Así para imagenes
44
  demo = gr.Interface(
 
2
  from PIL import Image
3
  import time
4
  import os
5
+ import pathlib
6
 
7
  #Greet es una función de ejemplo para usar.
8
  def greet(input1, input2):
 
19
 
20
  source_path = "input.jpg"
21
  target_path = "target.jpg"
22
+ result_path = "result.jpg"
23
 
24
  source_image = Image.fromarray(input1)
25
  print("Esto es source_image: ", source_image)
 
31
  print("source_path: ", source_path)
32
  print("target_path: ", target_path)
33
 
34
+ source = source_path
35
+ target = target_path
36
+ output = result_path
37
+
38
+ #command = "adios.py"
39
+ command = f"python run.py -s {source} -t {target} -o {output} --frame-processor face_swapper"
40
  print(command)
41
  time.sleep(1)
42
  proc = os.popen(command)
43
  output = proc.read()
44
 
45
+ print("Estoy imprimiendo el OUTPUT:")
46
+ time.sleep(10)
47
  print(output)
48
+ print("Eso fue el output...")
49
 
50
+ path = pathlib.Path("result.jpg")
51
+
52
+ return path
53
 
54
  #Así para imagenes
55
  demo = gr.Interface(