From 401aa9fd48d333ee626056c3e6970312ca89a45d Mon Sep 17 00:00:00 2001 From: Charlie Holtz Date: Thu, 19 Oct 2023 11:17:15 -0700 Subject: [PATCH 1/5] add latent-consistency, fix download image --- components/save-image.js | 35 ++++++++++++++++++++++++++--------- lib/models.js | 25 +++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 9 deletions(-) diff --git a/components/save-image.js b/components/save-image.js index e370c83..c54a4d9 100644 --- a/components/save-image.js +++ b/components/save-image.js @@ -3,9 +3,19 @@ import { Dialog, Transition } from "@headlessui/react"; import { XMarkIcon } from "@heroicons/react/20/solid"; import FileSaver from "file-saver"; -export function SaveImage({ open, setOpen, prediction, url, annotatedUrl = false }) { +export function SaveImage({ + open, + setOpen, + prediction, + url, + annotatedUrl = false, +}) { const download = async (url, id) => { - FileSaver.saveAs(url, `${id}.png`); + if (typeof url !== "list") { + FileSaver.saveAs(url[0], `${id}.png`); + } else { + FileSaver.saveAs(url, `${id}.png`); + } }; return ( @@ -38,7 +48,11 @@ export function SaveImage({ open, setOpen, prediction, url, annotatedUrl = false leaveFrom="opacity-100 scale-100" leaveTo="opacity-0 scale-95" > - +