From 99ed1bc9afc725b2efb8b361d64e00f6c8a897d8 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Sun, 19 May 2024 07:18:18 +0530 Subject: [PATCH] Show saved crops --- web/apps/photos/src/components/ml/PeopleList.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/web/apps/photos/src/components/ml/PeopleList.tsx b/web/apps/photos/src/components/ml/PeopleList.tsx index 9e5620a5c..35ef60e1e 100644 --- a/web/apps/photos/src/components/ml/PeopleList.tsx +++ b/web/apps/photos/src/components/ml/PeopleList.tsx @@ -1,3 +1,4 @@ +import { openCache } from "@/next/blob-cache"; import log from "@/next/log"; import { Skeleton, styled } from "@mui/material"; import { Legend } from "components/PhotoViewer/styledComponents/Legend"; @@ -165,12 +166,18 @@ const FaceCropImageView: React.FC = ({ if (faceID && electron) { electron .legacyFaceCrop(faceID) - /* - cachedOrNew("face-crops", cacheKey, async () => { + .then(async (data) => { + if (data) return data; + /* + TODO(MR): Also, get this to work on web too. + cachedOrNew("face-crops", cacheKey, async () => { return machineLearningService.regenerateFaceCrop( faceId, ); - })*/ + })*/ + const cache = await openCache("face-crops"); + return await cache.get(faceID); + }) .then((data) => { if (data) { const blob = new Blob([data]);