Spaces:
Runtime error
Runtime error
Julian Bilcke
commited on
Commit
·
cdbf536
1
Parent(s):
8378233
woops sorry folks
Browse files
engine.py
CHANGED
|
@@ -65,7 +65,7 @@ class Engine:
|
|
| 65 |
@alru_cache(maxsize=512)
|
| 66 |
async def load_image(self, data):
|
| 67 |
image = Image.open(io.BytesIO(data))
|
| 68 |
-
|
| 69 |
img_rgb = np.array(image)
|
| 70 |
|
| 71 |
inference_cfg = self.live_portrait.live_portrait_wrapper.cfg
|
|
@@ -87,13 +87,13 @@ class Engine:
|
|
| 87 |
'inference_cfg': inference_cfg
|
| 88 |
}
|
| 89 |
|
| 90 |
-
self.processed_cache[
|
| 91 |
|
| 92 |
# Calculate the bounding box
|
| 93 |
bbox_info = parse_bbox_from_landmark(processed_data['crop_info']['lmk_crop'], scale=1.0)
|
| 94 |
|
| 95 |
return {
|
| 96 |
-
'u':
|
| 97 |
|
| 98 |
# those aren't easy to serialize
|
| 99 |
'c': bbox_info['center'], # 2x1
|
|
|
|
| 65 |
@alru_cache(maxsize=512)
|
| 66 |
async def load_image(self, data):
|
| 67 |
image = Image.open(io.BytesIO(data))
|
| 68 |
+
uid = uuid.uuid4()
|
| 69 |
img_rgb = np.array(image)
|
| 70 |
|
| 71 |
inference_cfg = self.live_portrait.live_portrait_wrapper.cfg
|
|
|
|
| 87 |
'inference_cfg': inference_cfg
|
| 88 |
}
|
| 89 |
|
| 90 |
+
self.processed_cache[uid] = processed_data
|
| 91 |
|
| 92 |
# Calculate the bounding box
|
| 93 |
bbox_info = parse_bbox_from_landmark(processed_data['crop_info']['lmk_crop'], scale=1.0)
|
| 94 |
|
| 95 |
return {
|
| 96 |
+
'u': uid,
|
| 97 |
|
| 98 |
# those aren't easy to serialize
|
| 99 |
'c': bbox_info['center'], # 2x1
|