Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,10 +19,10 @@ st.title("🎭 DeepFlick: Live Deepfake & AI Voice Clone Streaming")
|
|
| 19 |
face_app = FaceAnalysis(name="buffalo_l")
|
| 20 |
face_app.prepare(ctx_id=0, det_size=(640, 640))
|
| 21 |
|
| 22 |
-
# Load
|
| 23 |
tts = TTS("tts_models/en/ljspeech/glow-tts").to("cpu")
|
| 24 |
|
| 25 |
-
# Function to Swap Faces
|
| 26 |
def swap_faces(source_img_path, target_img_path, output_path):
|
| 27 |
source_img = cv2.imread(source_img_path)
|
| 28 |
target_img = cv2.imread(target_img_path)
|
|
@@ -31,8 +31,8 @@ def swap_faces(source_img_path, target_img_path, output_path):
|
|
| 31 |
return None
|
| 32 |
|
| 33 |
swapped_img = DeepFace.swap(source_img, target_img, model_name="insightface")
|
| 34 |
-
|
| 35 |
cv2.imwrite(output_path, swapped_img)
|
|
|
|
| 36 |
return output_path
|
| 37 |
|
| 38 |
# Function to Generate AI Voice
|
|
|
|
| 19 |
face_app = FaceAnalysis(name="buffalo_l")
|
| 20 |
face_app.prepare(ctx_id=0, det_size=(640, 640))
|
| 21 |
|
| 22 |
+
# Load AI Voice Model
|
| 23 |
tts = TTS("tts_models/en/ljspeech/glow-tts").to("cpu")
|
| 24 |
|
| 25 |
+
# Function to Swap Faces
|
| 26 |
def swap_faces(source_img_path, target_img_path, output_path):
|
| 27 |
source_img = cv2.imread(source_img_path)
|
| 28 |
target_img = cv2.imread(target_img_path)
|
|
|
|
| 31 |
return None
|
| 32 |
|
| 33 |
swapped_img = DeepFace.swap(source_img, target_img, model_name="insightface")
|
|
|
|
| 34 |
cv2.imwrite(output_path, swapped_img)
|
| 35 |
+
|
| 36 |
return output_path
|
| 37 |
|
| 38 |
# Function to Generate AI Voice
|