From 7e68646b13093e2f702ca18a34f0cf8dc6fc5b9b Mon Sep 17 00:00:00 2001
From: YUHOUCHAXING <132468uh@gmail.com>
Date: Tue, 9 Apr 2024 17:12:55 +0800
Subject: [PATCH] According to discuss of
 https://github.com/OpenTalker/SadTalker/issues/839

I fixed the `ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (5,) + inhomogeneous part.`

And I also fixed `AttrubuteError: module `numpy` has no attribute 'float'`

Finally, I fixed the `AttributeError: 'Row' object has no attribute 'style'`
---
 requirements.txt                 | 2 +-
 src/face3d/util/my_awing_arch.py | 2 +-
 src/face3d/util/preprocess.py    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/requirements.txt b/requirements.txt
index b6505a54..e49f40fb 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -15,7 +15,7 @@ joblib==1.1.0
 scikit-image==0.19.3
 basicsr==1.4.2
 facexlib==0.3.0
-gradio
+gradio==3.5
 gfpgan
 av
 safetensors
diff --git a/src/face3d/util/my_awing_arch.py b/src/face3d/util/my_awing_arch.py
index cd565617..308752f6 100644
--- a/src/face3d/util/my_awing_arch.py
+++ b/src/face3d/util/my_awing_arch.py
@@ -15,7 +15,7 @@ def calculate_points(heatmaps):
     indexes = np.argmax(heatline, axis=2)
 
     preds = np.stack((indexes % W, indexes // W), axis=2)
-    preds = preds.astype(np.float, copy=False)
+    preds = preds.astype(float, copy=False)
 
     inr = indexes.ravel()
 
diff --git a/src/face3d/util/preprocess.py b/src/face3d/util/preprocess.py
index b77a3a40..5b911442 100644
--- a/src/face3d/util/preprocess.py
+++ b/src/face3d/util/preprocess.py
@@ -98,6 +98,6 @@ def align_img(img, lm, lm3D, mask=None, target_size=224., rescale_factor=102.):
 
     # processing the image
     img_new, lm_new, mask_new = resize_n_crop_img(img, lm, t, s, target_size=target_size, mask=mask)
-    trans_params = np.array([w0, h0, s, t[0], t[1]])
+    trans_params = np.array([w0, h0, s, t[0], t[1]], dtype=object)
 
     return trans_params, img_new, lm_new, mask_new