2023-09-10 20:00:49 +02:00
|
|
|
import { getPlatform } from "./get-device-specs";
|
2024-01-15 13:46:21 +01:00
|
|
|
import { ImageFormat } from "./types";
|
2023-04-29 02:18:19 +02:00
|
|
|
const slash: string = getPlatform() === "win" ? "\\" : "/";
|
|
|
|
|
2024-04-09 20:11:24 +02:00
|
|
|
export const getSingleImageArguments = ({
|
|
|
|
inputDir,
|
|
|
|
fullfileName,
|
|
|
|
outFile,
|
|
|
|
modelsPath,
|
|
|
|
model,
|
|
|
|
scale,
|
|
|
|
gpuId,
|
|
|
|
saveImageAs,
|
2024-04-20 17:44:42 +02:00
|
|
|
customWidth,
|
2024-04-09 20:11:24 +02:00
|
|
|
}: {
|
|
|
|
inputDir: string;
|
|
|
|
fullfileName: string;
|
|
|
|
outFile: string;
|
|
|
|
modelsPath: string;
|
|
|
|
model: string;
|
|
|
|
scale: any;
|
|
|
|
gpuId: string;
|
|
|
|
saveImageAs: ImageFormat;
|
2024-04-20 17:44:42 +02:00
|
|
|
customWidth: string;
|
2024-04-09 20:11:24 +02:00
|
|
|
}) => {
|
2023-03-18 13:15:48 +01:00
|
|
|
return [
|
|
|
|
"-i",
|
2023-04-29 02:18:19 +02:00
|
|
|
inputDir + slash + fullfileName,
|
2023-03-18 13:15:48 +01:00
|
|
|
"-o",
|
|
|
|
outFile,
|
2024-04-21 19:14:39 +02:00
|
|
|
customWidth ? "" : `-s ${scale}`,
|
2023-03-18 13:15:48 +01:00
|
|
|
"-m",
|
|
|
|
modelsPath,
|
|
|
|
"-n",
|
|
|
|
model,
|
2024-04-21 19:14:39 +02:00
|
|
|
gpuId ? `-g ${gpuId}` : "",
|
2023-03-18 13:15:48 +01:00
|
|
|
"-f",
|
|
|
|
saveImageAs,
|
2024-04-20 17:44:42 +02:00
|
|
|
customWidth ? `-w ${customWidth}` : "",
|
2023-03-18 13:15:48 +01:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2024-04-09 20:11:24 +02:00
|
|
|
export const getDoubleUpscaleArguments = ({
|
|
|
|
inputDir,
|
|
|
|
fullfileName,
|
|
|
|
outFile,
|
|
|
|
modelsPath,
|
|
|
|
model,
|
|
|
|
gpuId,
|
|
|
|
saveImageAs,
|
|
|
|
scale,
|
2024-04-21 19:14:39 +02:00
|
|
|
customWidth,
|
2024-04-09 20:11:24 +02:00
|
|
|
}: {
|
|
|
|
inputDir: string;
|
|
|
|
fullfileName: string;
|
|
|
|
outFile: string;
|
|
|
|
modelsPath: string;
|
|
|
|
model: string;
|
|
|
|
gpuId: string;
|
|
|
|
saveImageAs: ImageFormat;
|
|
|
|
scale: string;
|
2024-04-21 19:14:39 +02:00
|
|
|
customWidth: string;
|
2024-04-09 20:11:24 +02:00
|
|
|
}) => {
|
2023-03-18 13:15:48 +01:00
|
|
|
return [
|
|
|
|
"-i",
|
2023-04-29 02:18:19 +02:00
|
|
|
inputDir + slash + fullfileName,
|
2023-03-18 13:15:48 +01:00
|
|
|
"-o",
|
|
|
|
outFile,
|
2024-04-21 19:14:39 +02:00
|
|
|
customWidth ? "" : `-s ${scale}`,
|
2023-03-18 13:15:48 +01:00
|
|
|
"-m",
|
|
|
|
modelsPath,
|
|
|
|
"-n",
|
|
|
|
model,
|
2024-04-21 19:14:39 +02:00
|
|
|
gpuId ? `-g ${gpuId}` : "",
|
2023-03-18 13:15:48 +01:00
|
|
|
"-f",
|
|
|
|
saveImageAs,
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2024-04-09 20:11:24 +02:00
|
|
|
export const getDoubleUpscaleSecondPassArguments = ({
|
|
|
|
outFile,
|
|
|
|
modelsPath,
|
|
|
|
model,
|
|
|
|
gpuId,
|
|
|
|
saveImageAs,
|
|
|
|
scale,
|
2024-04-20 17:44:42 +02:00
|
|
|
customWidth,
|
2024-04-09 20:11:24 +02:00
|
|
|
}: {
|
|
|
|
outFile: string;
|
|
|
|
modelsPath: string;
|
|
|
|
model: string;
|
|
|
|
gpuId: string;
|
|
|
|
saveImageAs: ImageFormat;
|
|
|
|
scale: string;
|
2024-04-20 17:44:42 +02:00
|
|
|
customWidth: string;
|
2024-04-09 20:11:24 +02:00
|
|
|
}) => {
|
2023-03-18 13:15:48 +01:00
|
|
|
return [
|
|
|
|
"-i",
|
2024-04-21 19:14:39 +02:00
|
|
|
outFile,
|
2023-03-18 13:15:48 +01:00
|
|
|
"-o",
|
2024-04-21 19:14:39 +02:00
|
|
|
outFile,
|
2023-03-18 13:15:48 +01:00
|
|
|
"-s",
|
2024-04-21 19:14:39 +02:00
|
|
|
customWidth ? "" : `-s ${scale}`,
|
2023-03-18 13:15:48 +01:00
|
|
|
"-m",
|
|
|
|
modelsPath,
|
|
|
|
"-n",
|
|
|
|
model,
|
2024-04-21 19:14:39 +02:00
|
|
|
gpuId ? `-g ${gpuId}` : "",
|
|
|
|
"-f",
|
|
|
|
saveImageAs,
|
2024-04-20 17:44:42 +02:00
|
|
|
customWidth ? `-w ${customWidth}` : "",
|
2023-03-18 13:15:48 +01:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2024-04-09 20:11:24 +02:00
|
|
|
export const getBatchArguments = ({
|
|
|
|
inputDir,
|
|
|
|
outputDir,
|
|
|
|
modelsPath,
|
|
|
|
model,
|
|
|
|
gpuId,
|
|
|
|
saveImageAs,
|
|
|
|
scale,
|
2024-04-20 17:44:42 +02:00
|
|
|
customWidth,
|
2024-04-09 20:11:24 +02:00
|
|
|
}: {
|
|
|
|
inputDir: string;
|
|
|
|
outputDir: string;
|
|
|
|
modelsPath: string;
|
|
|
|
model: string;
|
|
|
|
gpuId: string;
|
|
|
|
saveImageAs: ImageFormat;
|
|
|
|
scale: string;
|
2024-04-20 17:44:42 +02:00
|
|
|
customWidth: string;
|
2024-04-09 20:11:24 +02:00
|
|
|
}) => {
|
2023-03-18 13:15:48 +01:00
|
|
|
return [
|
|
|
|
"-i",
|
|
|
|
inputDir,
|
|
|
|
"-o",
|
|
|
|
outputDir,
|
2024-04-21 19:14:39 +02:00
|
|
|
customWidth ? "" : `-s ${scale}`,
|
2023-03-18 13:15:48 +01:00
|
|
|
"-m",
|
|
|
|
modelsPath,
|
|
|
|
"-n",
|
|
|
|
model,
|
2024-04-21 19:14:39 +02:00
|
|
|
gpuId ? `-g ${gpuId}` : "",
|
2023-03-18 13:15:48 +01:00
|
|
|
"-f",
|
|
|
|
saveImageAs,
|
2024-04-20 17:44:42 +02:00
|
|
|
customWidth ? `-w ${customWidth}` : "",
|
2024-01-16 09:19:27 +01:00
|
|
|
];
|
2023-03-18 13:15:48 +01:00
|
|
|
};
|