mirror of
https://github.com/upscayl/upscayl.git
synced 2026-04-03 03:00:13 -04:00
Update images and fix model issue
This commit is contained in:
@@ -14,7 +14,7 @@ import { modelsPath } from "../utils/get-resource-paths";
|
||||
import { ELECTRON_COMMANDS } from "../../common/electron-commands";
|
||||
import { BatchUpscaylPayload } from "../../common/types/types";
|
||||
import showNotification from "../utils/show-notification";
|
||||
import { DEFAULT_MODELS_ID_LIST } from "../../common/models-list";
|
||||
import { MODELS } from "../../common/models-list";
|
||||
|
||||
const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
|
||||
const mainWindow = getMainWindow();
|
||||
@@ -41,7 +41,7 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
|
||||
fs.mkdirSync(outputFolderPath, { recursive: true });
|
||||
}
|
||||
|
||||
const isDefaultModel = DEFAULT_MODELS_ID_LIST.includes(model);
|
||||
const isDefaultModel = model in MODELS;
|
||||
|
||||
// UPSCALE
|
||||
const upscayl = spawnUpscayl(
|
||||
@@ -50,7 +50,7 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
|
||||
outputDir: outputFolderPath,
|
||||
modelsPath: isDefaultModel
|
||||
? modelsPath
|
||||
: savedCustomModelsPath ?? modelsPath,
|
||||
: (savedCustomModelsPath ?? modelsPath),
|
||||
model,
|
||||
gpuId,
|
||||
saveImageAs,
|
||||
@@ -75,9 +75,13 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
|
||||
ELECTRON_COMMANDS.FOLDER_UPSCAYL_PROGRESS,
|
||||
data.toString(),
|
||||
);
|
||||
if ((data as string).includes("Error")) {
|
||||
if (
|
||||
(data as string).includes("Error") ||
|
||||
(data as string).includes("failed")
|
||||
) {
|
||||
logit("❌ ", data);
|
||||
encounteredError = true;
|
||||
onError(data);
|
||||
} else if (data.includes("Resizing")) {
|
||||
mainWindow.webContents.send(ELECTRON_COMMANDS.SCALING_AND_CONVERTING);
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@ import { ELECTRON_COMMANDS } from "../../common/electron-commands";
|
||||
import { DoubleUpscaylPayload } from "../../common/types/types";
|
||||
import { ImageFormat } from "../types/types";
|
||||
import showNotification from "../utils/show-notification";
|
||||
import { DEFAULT_MODELS_ID_LIST } from "../../common/models-list";
|
||||
import getFilenameFromPath from "../../common/get-file-name";
|
||||
import decodePath from "../../common/decode-path";
|
||||
import getDirectoryFromPath from "../../common/get-directory-from-path";
|
||||
import { MODELS } from "../../common/models-list";
|
||||
|
||||
const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => {
|
||||
const mainWindow = getMainWindow();
|
||||
@@ -41,7 +41,7 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => {
|
||||
const fullfileName = getFilenameFromPath(imagePath);
|
||||
const fileName = parse(fullfileName).name;
|
||||
|
||||
const isDefaultModel = DEFAULT_MODELS_ID_LIST.includes(model);
|
||||
const isDefaultModel = model in MODELS;
|
||||
|
||||
// COPY IMAGE TO TMP FOLDER
|
||||
|
||||
@@ -63,7 +63,7 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => {
|
||||
outFile,
|
||||
modelsPath: isDefaultModel
|
||||
? modelsPath
|
||||
: savedCustomModelsPath ?? modelsPath,
|
||||
: (savedCustomModelsPath ?? modelsPath),
|
||||
model,
|
||||
scale,
|
||||
customWidth,
|
||||
@@ -113,9 +113,10 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => {
|
||||
data,
|
||||
);
|
||||
// IF PROGRESS HAS ERROR, UPSCAYL FAILED
|
||||
if (data.includes("Error")) {
|
||||
if (data.includes("Error") || data.includes("failed")) {
|
||||
upscayl2.kill();
|
||||
failed2 = true;
|
||||
onError2(data);
|
||||
} else if (data.includes("Resizing")) {
|
||||
mainWindow.webContents.send(ELECTRON_COMMANDS.SCALING_AND_CONVERTING);
|
||||
}
|
||||
@@ -170,6 +171,7 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => {
|
||||
if (data.includes("Error") || data.includes("failed")) {
|
||||
upscayl.kill();
|
||||
failed = true;
|
||||
onError(data);
|
||||
} else if (data.includes("Resizing")) {
|
||||
mainWindow.webContents.send(ELECTRON_COMMANDS.SCALING_AND_CONVERTING);
|
||||
}
|
||||
@@ -184,7 +186,7 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => {
|
||||
outFile,
|
||||
modelsPath: isDefaultModel
|
||||
? modelsPath
|
||||
: savedCustomModelsPath ?? modelsPath,
|
||||
: (savedCustomModelsPath ?? modelsPath),
|
||||
model,
|
||||
gpuId,
|
||||
saveImageAs,
|
||||
|
||||
@@ -16,10 +16,10 @@ import { getMainWindow } from "../main-window";
|
||||
import { ImageUpscaylPayload } from "../../common/types/types";
|
||||
import { ImageFormat } from "../types/types";
|
||||
import showNotification from "../utils/show-notification";
|
||||
import { DEFAULT_MODELS_ID_LIST } from "../../common/models-list";
|
||||
import getFilenameFromPath from "../../common/get-file-name";
|
||||
import decodePath from "../../common/decode-path";
|
||||
import getDirectoryFromPath from "../../common/get-directory-from-path";
|
||||
import { MODELS } from "../../common/models-list";
|
||||
|
||||
const imageUpscayl = async (event, payload: ImageUpscaylPayload) => {
|
||||
const mainWindow = getMainWindow();
|
||||
@@ -55,7 +55,7 @@ const imageUpscayl = async (event, payload: ImageUpscaylPayload) => {
|
||||
"." +
|
||||
saveImageAs;
|
||||
|
||||
const isDefaultModel = DEFAULT_MODELS_ID_LIST.includes(model);
|
||||
const isDefaultModel = model in MODELS;
|
||||
|
||||
// Check if windows can write the new filename to the file system
|
||||
if (outFile.length >= 255) {
|
||||
@@ -97,7 +97,7 @@ const imageUpscayl = async (event, payload: ImageUpscaylPayload) => {
|
||||
outFile,
|
||||
modelsPath: isDefaultModel
|
||||
? modelsPath
|
||||
: savedCustomModelsPath ?? modelsPath,
|
||||
: (savedCustomModelsPath ?? modelsPath),
|
||||
model,
|
||||
scale,
|
||||
gpuId,
|
||||
@@ -122,9 +122,10 @@ const imageUpscayl = async (event, payload: ImageUpscaylPayload) => {
|
||||
ELECTRON_COMMANDS.UPSCAYL_PROGRESS,
|
||||
data.toString(),
|
||||
);
|
||||
if (data.includes("Error")) {
|
||||
if (data.includes("Error") || data.includes("failed")) {
|
||||
upscayl.kill();
|
||||
failed = true;
|
||||
onError(data);
|
||||
} else if (data.includes("Resizing")) {
|
||||
mainWindow.webContents.send(ELECTRON_COMMANDS.SCALING_AND_CONVERTING);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user