1
0
mirror of https://github.com/upscayl/upscayl.git synced 2025-01-18 17:14:08 +01:00

Fixed app restart default model issue

This commit is contained in:
Feenix 2023-03-12 13:11:43 +05:30
parent e5717dda54
commit b1b0731925
4 changed files with 14097 additions and 2267 deletions

11233
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -12,18 +12,19 @@ interface IProps {
outputHandler: () => Promise<void>;
upscaylHandler: () => Promise<void>;
batchMode: boolean;
setBatchMode: (arg: any) => void;
setBatchMode: React.Dispatch<React.SetStateAction<boolean>>;
imagePath: string;
outputPath: string;
doubleUpscayl: boolean;
setDoubleUpscayl: (arg: boolean) => void;
setDoubleUpscayl: React.Dispatch<React.SetStateAction<boolean>>;
model: string;
setModel: React.Dispatch<React.SetStateAction<string>>;
isVideo: boolean;
setIsVideo: (arg: boolean) => void;
setIsVideo: React.Dispatch<React.SetStateAction<boolean>>;
saveImageAs: string;
setSaveImageAs: (arg: string) => void;
setSaveImageAs: React.Dispatch<React.SetStateAction<string>>;
gpuId: string;
setGpuId: (arg: string) => void;
setGpuId: React.Dispatch<React.SetStateAction<string>>;
dimensions: {
width: number | null;
height: number | null;
@ -45,6 +46,7 @@ function LeftPaneImageSteps({
doubleUpscayl,
setDoubleUpscayl,
model,
setModel,
isVideo,
setIsVideo,
gpuId,
@ -67,23 +69,34 @@ function LeftPaneImageSteps({
if (!localStorage.getItem("saveImageAs")) {
localStorage.setItem("saveImageAs", "png");
} else {
setSaveImageAs(localStorage.getItem("saveImageAs"));
const currentlySavedImageFormat = localStorage.getItem("saveImageAs");
setSaveImageAs(currentlySavedImageFormat);
}
if (!localStorage.getItem("model")) {
setCurrentModel(modelOptions[0]);
setModel(modelOptions[0].value);
localStorage.setItem("model", JSON.stringify(modelOptions[0]));
} else {
setCurrentModel(JSON.parse(localStorage.getItem("model")));
const currentlySavedModel = JSON.parse(
localStorage.getItem("model")
) as typeof modelOptions[0];
setCurrentModel(currentlySavedModel);
setModel(currentlySavedModel.value);
}
if (!localStorage.getItem("gpuId")) {
localStorage.setItem("gpuId", "");
} else {
setGpuId(localStorage.getItem("gpuId"));
const currentlySavedGpuId = localStorage.getItem("gpuId");
setGpuId(currentlySavedGpuId);
}
}, []);
useEffect(() => {
console.log("Current Model: ", currentModel);
}, [currentModel]);
const setExportType = (format: string) => {
setSaveImageAs(format);
localStorage.setItem("saveImageAs", format);

View File

@ -332,6 +332,7 @@ const Home = () => {
} else {
setUpscaledImagePath("");
}
if (!isVideo && (imagePath !== "" || batchFolderPath !== "")) {
setProgress("Hold on...");
if (model === "models-DF2K") {
@ -443,6 +444,7 @@ const Home = () => {
doubleUpscayl={doubleUpscayl}
setDoubleUpscayl={setDoubleUpscayl}
model={model}
setModel={setModel}
isVideo={isVideo}
setIsVideo={setIsVideo}
gpuId={gpuId}

5100
yarn.lock

File diff suppressed because it is too large Load Diff