Spaces:
Sleeping
Sleeping
Moibe
commited on
Commit
•
410276e
1
Parent(s):
7310428
Ready for video
Browse files- .gitignore +1 -0
- app.py +20 -12
.gitignore
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
input.jpg
|
2 |
result.jpg
|
3 |
target.jpg
|
|
|
4 |
|
5 |
|
6 |
inswapper_128.onnx
|
|
|
1 |
input.jpg
|
2 |
result.jpg
|
3 |
target.jpg
|
4 |
+
result.mp4
|
5 |
|
6 |
|
7 |
inswapper_128.onnx
|
app.py
CHANGED
@@ -18,15 +18,20 @@ def greet(input1, input2):
|
|
18 |
#Y al parecer PIL ya lo tiene instalado.
|
19 |
|
20 |
source_path = "input.jpg"
|
21 |
-
target_path = "target.
|
22 |
-
result_path = "result.
|
23 |
|
|
|
24 |
source_image = Image.fromarray(input1)
|
25 |
print("Esto es source_image: ", source_image)
|
26 |
source_image.save(source_path)
|
27 |
-
target_image = Image.fromarray(input2)
|
28 |
-
print("Esto es target_image: ", target_image)
|
29 |
-
target_image.save(target_path)
|
|
|
|
|
|
|
|
|
30 |
|
31 |
print("source_path: ", source_path)
|
32 |
print("target_path: ", target_path)
|
@@ -43,22 +48,25 @@ def greet(input1, input2):
|
|
43 |
output = proc.read()
|
44 |
|
45 |
print("Estoy imprimiendo el OUTPUT:")
|
46 |
-
time.sleep(
|
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(
|
56 |
-
fn=greet, inputs=[gr.Image(), gr.Image()], outputs="image"
|
57 |
-
)
|
58 |
-
|
59 |
-
#Así para video
|
60 |
# demo = gr.Interface(
|
61 |
-
# fn=greet, inputs=[gr.
|
62 |
# )
|
63 |
|
|
|
|
|
|
|
|
|
|
|
64 |
demo.launch()
|
|
|
18 |
#Y al parecer PIL ya lo tiene instalado.
|
19 |
|
20 |
source_path = "input.jpg"
|
21 |
+
target_path = "target.mp4"
|
22 |
+
result_path = "result.mp4"
|
23 |
|
24 |
+
#Para Imagenes
|
25 |
source_image = Image.fromarray(input1)
|
26 |
print("Esto es source_image: ", source_image)
|
27 |
source_image.save(source_path)
|
28 |
+
# target_image = Image.fromarray(input2)
|
29 |
+
# print("Esto es target_image: ", target_image)
|
30 |
+
# target_image.save(target_path)
|
31 |
+
|
32 |
+
#Para Video
|
33 |
+
#source_path = input1
|
34 |
+
target_path = input2
|
35 |
|
36 |
print("source_path: ", source_path)
|
37 |
print("target_path: ", target_path)
|
|
|
48 |
output = proc.read()
|
49 |
|
50 |
print("Estoy imprimiendo el OUTPUT:")
|
51 |
+
time.sleep(3)
|
52 |
print(output)
|
53 |
print("Eso fue el output...")
|
54 |
|
55 |
+
#Para imagen
|
56 |
path = pathlib.Path("result.jpg")
|
57 |
+
#Para video
|
58 |
+
path = pathlib.Path("result.mp4")
|
59 |
|
60 |
return path
|
61 |
|
62 |
#Así para imagenes
|
|
|
|
|
|
|
|
|
|
|
63 |
# demo = gr.Interface(
|
64 |
+
# fn=greet, inputs=[gr.Image(), gr.Image()], outputs="image"
|
65 |
# )
|
66 |
|
67 |
+
#Así para video
|
68 |
+
demo = gr.Interface(
|
69 |
+
fn=greet, inputs=[gr.Image(), gr.Video()], outputs="video"
|
70 |
+
)
|
71 |
+
|
72 |
demo.launch()
|