Spaces:
Sleeping
Sleeping
victorisgeek
commited on
Commit
•
4e8017b
1
Parent(s):
563ea18
Update app.py
Browse files
app.py
CHANGED
@@ -40,7 +40,7 @@ def process_file(image):
|
|
40 |
|
41 |
faces, img = detect_faces(filename)
|
42 |
if len(faces) < 2:
|
43 |
-
return "Need at least two faces to swap"
|
44 |
|
45 |
swapped_img = swap_faces(img, faces[0], faces[1])
|
46 |
|
@@ -53,12 +53,11 @@ if not os.path.exists(UPLOAD_FOLDER):
|
|
53 |
|
54 |
iface = gr.Interface(
|
55 |
fn=process_file,
|
56 |
-
inputs=gr.Image(type="numpy", label="Upload an Image"),
|
57 |
outputs=gr.Image(type="numpy", label="Swapped Faces"),
|
58 |
title="Face Swap",
|
59 |
description="Upload an image with at least two faces, and this tool will swap the faces."
|
60 |
)
|
61 |
|
62 |
if __name__ == "__main__":
|
63 |
-
iface.queue().launch(show_error=True, share=True, server_name="0.0.0.0", server_port=7860)
|
64 |
-
|
|
|
40 |
|
41 |
faces, img = detect_faces(filename)
|
42 |
if len(faces) < 2:
|
43 |
+
return "Need at least two faces to swap."
|
44 |
|
45 |
swapped_img = swap_faces(img, faces[0], faces[1])
|
46 |
|
|
|
53 |
|
54 |
iface = gr.Interface(
|
55 |
fn=process_file,
|
56 |
+
inputs=gr.Image(type="numpy", label="Upload an Image"), # Gradio handles the file upload
|
57 |
outputs=gr.Image(type="numpy", label="Swapped Faces"),
|
58 |
title="Face Swap",
|
59 |
description="Upload an image with at least two faces, and this tool will swap the faces."
|
60 |
)
|
61 |
|
62 |
if __name__ == "__main__":
|
63 |
+
iface.queue().launch(show_error=True, share=True, server_name="0.0.0.0", server_port=7860)
|
|