Update main.py
Browse files
main.py
CHANGED
|
@@ -58,6 +58,10 @@ def swap_faces(
|
|
| 58 |
source_faces = app.get(source_image)
|
| 59 |
destination_faces = app.get(destination_image)
|
| 60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
faces = sort_faces(source_faces)
|
| 62 |
source_face = get_face(faces, sourceFaceIndex)
|
| 63 |
|
|
@@ -69,6 +73,7 @@ def swap_faces(
|
|
| 69 |
|
| 70 |
|
| 71 |
|
|
|
|
| 72 |
|
| 73 |
app.mount("/", StaticFiles(directory="static", html=True), name="static")
|
| 74 |
|
|
|
|
| 58 |
source_faces = app.get(source_image)
|
| 59 |
destination_faces = app.get(destination_image)
|
| 60 |
|
| 61 |
+
# Ensure that source and destination images are in the correct format
|
| 62 |
+
if isinstance(source_faces, str) or isinstance(destination_faces, str):
|
| 63 |
+
raise HTTPException(status_code=500, detail="Error processing images.")
|
| 64 |
+
|
| 65 |
faces = sort_faces(source_faces)
|
| 66 |
source_face = get_face(faces, sourceFaceIndex)
|
| 67 |
|
|
|
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
+
|
| 77 |
|
| 78 |
app.mount("/", StaticFiles(directory="static", html=True), name="static")
|
| 79 |
|