mirror of
https://github.com/upscayl/upscayl.git
synced 2026-04-03 03:00:13 -04:00
Add TTA Mode
This commit is contained in:
3
common/types/types.d.ts
vendored
3
common/types/types.d.ts
vendored
@@ -13,6 +13,7 @@ export type ImageUpscaylPayload = {
|
||||
customWidth: string;
|
||||
useCustomWidth: boolean;
|
||||
tileSize: number;
|
||||
ttaMode: boolean;
|
||||
};
|
||||
|
||||
export type DoubleUpscaylPayload = {
|
||||
@@ -30,6 +31,7 @@ export type DoubleUpscaylPayload = {
|
||||
customWidth: string;
|
||||
useCustomWidth: boolean;
|
||||
tileSize: number;
|
||||
ttaMode: boolean;
|
||||
};
|
||||
|
||||
export type BatchUpscaylPayload = {
|
||||
@@ -44,4 +46,5 @@ export type BatchUpscaylPayload = {
|
||||
customWidth: string;
|
||||
useCustomWidth: boolean;
|
||||
tileSize: number;
|
||||
ttaMode: boolean;
|
||||
};
|
||||
|
||||
@@ -22,6 +22,7 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
|
||||
|
||||
const tileSize = payload.tileSize;
|
||||
const compression = payload.compression;
|
||||
const ttaMode = payload.ttaMode;
|
||||
const scale = payload.scale;
|
||||
const useCustomWidth = payload.useCustomWidth;
|
||||
const customWidth = useCustomWidth ? payload.customWidth : "";
|
||||
@@ -58,6 +59,7 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
|
||||
customWidth,
|
||||
compression,
|
||||
tileSize,
|
||||
ttaMode,
|
||||
}),
|
||||
logit,
|
||||
);
|
||||
|
||||
@@ -29,6 +29,7 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => {
|
||||
|
||||
const tileSize = payload.tileSize;
|
||||
const compression = payload.compression;
|
||||
const ttaMode = payload.ttaMode;
|
||||
const scale = payload.scale;
|
||||
const useCustomWidth = payload.useCustomWidth;
|
||||
const customWidth = useCustomWidth ? payload.customWidth : "";
|
||||
@@ -194,6 +195,7 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => {
|
||||
customWidth,
|
||||
compression,
|
||||
tileSize,
|
||||
ttaMode,
|
||||
}),
|
||||
logit,
|
||||
);
|
||||
|
||||
@@ -32,6 +32,7 @@ const imageUpscayl = async (event, payload: ImageUpscaylPayload) => {
|
||||
// GET VARIABLES
|
||||
const tileSize = payload.tileSize;
|
||||
const compression = payload.compression;
|
||||
const ttaMode = payload.ttaMode;
|
||||
const scale = payload.scale;
|
||||
const useCustomWidth = payload.useCustomWidth;
|
||||
const customWidth = useCustomWidth ? payload.customWidth : "";
|
||||
@@ -105,6 +106,7 @@ const imageUpscayl = async (event, payload: ImageUpscaylPayload) => {
|
||||
customWidth,
|
||||
compression,
|
||||
tileSize,
|
||||
ttaMode,
|
||||
}),
|
||||
logit,
|
||||
);
|
||||
|
||||
@@ -15,6 +15,7 @@ export const getSingleImageArguments = ({
|
||||
customWidth,
|
||||
tileSize,
|
||||
compression,
|
||||
ttaMode,
|
||||
}: {
|
||||
inputDir: string;
|
||||
fileNameWithExt: string;
|
||||
@@ -27,6 +28,7 @@ export const getSingleImageArguments = ({
|
||||
customWidth: string;
|
||||
tileSize: number;
|
||||
compression: string;
|
||||
ttaMode: boolean;
|
||||
}) => {
|
||||
const modelScale = getModelScale(model);
|
||||
let includeScale = modelScale !== scale && !customWidth;
|
||||
@@ -61,6 +63,8 @@ export const getSingleImageArguments = ({
|
||||
// TILE SIZE
|
||||
tileSize ? `-t` : "",
|
||||
tileSize ? tileSize.toString() : "",
|
||||
// TTA MODE
|
||||
ttaMode ? "-x" : "",
|
||||
];
|
||||
};
|
||||
|
||||
@@ -127,6 +131,7 @@ export const getDoubleUpscaleSecondPassArguments = ({
|
||||
customWidth,
|
||||
compression,
|
||||
tileSize,
|
||||
ttaMode,
|
||||
}: {
|
||||
outFile: string;
|
||||
modelsPath: string;
|
||||
@@ -137,6 +142,7 @@ export const getDoubleUpscaleSecondPassArguments = ({
|
||||
customWidth: string;
|
||||
compression: string;
|
||||
tileSize: number;
|
||||
ttaMode: boolean;
|
||||
}) => {
|
||||
const modelScale = getModelScale(model);
|
||||
let includeScale = modelScale !== scale && !customWidth;
|
||||
@@ -171,6 +177,8 @@ export const getDoubleUpscaleSecondPassArguments = ({
|
||||
// TILE SIZE
|
||||
tileSize ? `-t` : "",
|
||||
tileSize ? tileSize.toString() : "",
|
||||
// TTA MODE
|
||||
ttaMode ? "-x" : "",
|
||||
];
|
||||
};
|
||||
|
||||
@@ -185,6 +193,7 @@ export const getBatchArguments = ({
|
||||
customWidth,
|
||||
compression,
|
||||
tileSize,
|
||||
ttaMode,
|
||||
}: {
|
||||
inputDir: string;
|
||||
outputDir: string;
|
||||
@@ -196,6 +205,7 @@ export const getBatchArguments = ({
|
||||
customWidth: string;
|
||||
compression: string;
|
||||
tileSize: number;
|
||||
ttaMode: boolean;
|
||||
}) => {
|
||||
const modelScale = getModelScale(model);
|
||||
let includeScale = modelScale !== scale && !customWidth;
|
||||
@@ -231,5 +241,7 @@ export const getBatchArguments = ({
|
||||
// TILE SIZE
|
||||
tileSize ? `-t` : "",
|
||||
tileSize ? tileSize.toString() : "",
|
||||
// TTA MODE
|
||||
ttaMode ? "-x" : "",
|
||||
];
|
||||
};
|
||||
|
||||
@@ -58,6 +58,8 @@ export const turnOffNotificationsAtom = atomWithStorage(
|
||||
false,
|
||||
);
|
||||
|
||||
export const ttaModeAtom = atomWithStorage("ttaMode", false);
|
||||
|
||||
export const viewTypeAtom = atomWithStorage<"slider" | "lens">(
|
||||
"viewType",
|
||||
"slider",
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
gpuIdAtom,
|
||||
saveImageAsAtom,
|
||||
userStatsAtom,
|
||||
ttaModeAtom,
|
||||
} from "../../atoms/user-settings-atom";
|
||||
import useLogger from "../hooks/use-logger";
|
||||
import {
|
||||
@@ -91,6 +92,7 @@ const Sidebar = ({
|
||||
const tileSize = useAtomValue(tileSizeAtom);
|
||||
const [showSidebar, setShowSidebar] = useAtom(showSidebarAtom);
|
||||
const setUserStats = useSetAtom(userStatsAtom);
|
||||
const ttaMode = useAtomValue(ttaModeAtom);
|
||||
|
||||
const upscaylHandler = async () => {
|
||||
logit("🔄 Resetting Upscaled Image Path");
|
||||
@@ -114,6 +116,7 @@ const Sidebar = ({
|
||||
customWidth: customWidth > 0 ? customWidth.toString() : null,
|
||||
useCustomWidth,
|
||||
tileSize,
|
||||
ttaMode,
|
||||
},
|
||||
);
|
||||
setUserStats((prev) => ({
|
||||
@@ -141,6 +144,7 @@ const Sidebar = ({
|
||||
customWidth: customWidth > 0 ? customWidth.toString() : null,
|
||||
useCustomWidth,
|
||||
tileSize,
|
||||
ttaMode,
|
||||
},
|
||||
);
|
||||
setUserStats((prev) => ({
|
||||
@@ -165,6 +169,7 @@ const Sidebar = ({
|
||||
customWidth: customWidth > 0 ? customWidth.toString() : null,
|
||||
useCustomWidth,
|
||||
tileSize,
|
||||
ttaMode,
|
||||
});
|
||||
setUserStats((prev) => ({
|
||||
...prev,
|
||||
|
||||
@@ -23,6 +23,7 @@ import { translationAtom } from "@/atoms/translations-atom";
|
||||
import { ImageFormat } from "@/lib/valid-formats";
|
||||
import EnableContributionToggle from "./enable-contributions-toggle";
|
||||
import AutoUpdateToggle from "./auto-update-toggle";
|
||||
import TTAModeToggle from "./tta-mode-toggle";
|
||||
|
||||
interface IProps {
|
||||
batchMode: boolean;
|
||||
@@ -186,6 +187,8 @@ function SettingsTab({
|
||||
setCustomModelsPath={setCustomModelsPath}
|
||||
/>
|
||||
|
||||
<TTAModeToggle />
|
||||
|
||||
{/* RESET SETTINGS */}
|
||||
<ResetSettingsButton />
|
||||
|
||||
|
||||
27
renderer/components/sidebar/settings-tab/tta-mode-toggle.tsx
Normal file
27
renderer/components/sidebar/settings-tab/tta-mode-toggle.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import { translationAtom } from "@/atoms/translations-atom";
|
||||
import { ttaModeAtom } from "@/atoms/user-settings-atom";
|
||||
import { useAtom, useAtomValue } from "jotai";
|
||||
|
||||
const TTAModeToggle = () => {
|
||||
const [ttaMode, setTTAMode] = useAtom(ttaModeAtom);
|
||||
const t = useAtomValue(translationAtom);
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-2">
|
||||
<p className="text-sm font-medium">{t("SETTINGS.TTA_MODE.TITLE")}</p>
|
||||
<p className="text-xs text-base-content/80">
|
||||
{t("SETTINGS.TTA_MODE.DESCRIPTION")}
|
||||
</p>
|
||||
<input
|
||||
type="checkbox"
|
||||
className="toggle"
|
||||
checked={ttaMode}
|
||||
onClick={() => {
|
||||
setTTAMode(!ttaMode);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default TTAModeToggle;
|
||||
@@ -93,6 +93,10 @@
|
||||
"TITLE": "Having issues?",
|
||||
"DOCS_BUTTON_TITLE": "🙏 GET HELP",
|
||||
"EMAIL_BUTTON_TITLE": "📧 EMAIL DEVELOPER"
|
||||
},
|
||||
"TTA_MODE": {
|
||||
"TITLE": "TTA Mode",
|
||||
"DESCRIPTION": "Enable Test Time Augmentation for better results, such as removing artifacts BUT this will increase the processing time by 8x!"
|
||||
}
|
||||
},
|
||||
"APP": {
|
||||
|
||||
@@ -93,6 +93,10 @@
|
||||
"TITLE": "¿Tienes problemas?",
|
||||
"DOCS_BUTTON_TITLE": "🙏 OBTENER AYUDA",
|
||||
"EMAIL_BUTTON_TITLE": "📧 CORREO AL DESARROLLADOR"
|
||||
},
|
||||
"TTA_MODE": {
|
||||
"TITLE": "Modo TTA",
|
||||
"DESCRIPTION": "Habilita la Aumentación en Tiempo de Prueba para obtener mejores resultados, como eliminar artefactos, ¡PERO esto aumentará el tiempo de procesamiento en 8x!"
|
||||
}
|
||||
},
|
||||
"APP": {
|
||||
|
||||
@@ -93,6 +93,10 @@
|
||||
"TITLE": "Vous avez des problèmes ?",
|
||||
"DOCS_BUTTON_TITLE": "🙏 OBTENIR DE L'AIDE",
|
||||
"EMAIL_BUTTON_TITLE": "📧 EMAIL AU DÉVELOPPEUR"
|
||||
},
|
||||
"TTA_MODE": {
|
||||
"TITLE": "Mode TTA",
|
||||
"DESCRIPTION": "Activez l'augmentation du temps de test pour de meilleurs résultats, comme la suppression des artefacts, MAIS cela augmentera le temps de traitement par 8x !"
|
||||
}
|
||||
},
|
||||
"APP": {
|
||||
|
||||
@@ -93,6 +93,10 @@
|
||||
"TITLE": "問題がありますか?",
|
||||
"DOCS_BUTTON_TITLE": "🙏 サポートを受ける",
|
||||
"EMAIL_BUTTON_TITLE": "📧 開発者にメール"
|
||||
},
|
||||
"TTA_MODE": {
|
||||
"TITLE": "TTAモード",
|
||||
"DESCRIPTION": "テストタイムオーグメンテーションを有効にして、アーティファクトの除去など、より良い結果を得ることができますが、処理時間が8倍に増加します!"
|
||||
}
|
||||
},
|
||||
"APP": {
|
||||
|
||||
@@ -93,6 +93,10 @@
|
||||
"TITLE": "Возникли проблемы?",
|
||||
"DOCS_BUTTON_TITLE": "🙏 ПОЛУЧИТЬ ПОМОЩЬ",
|
||||
"EMAIL_BUTTON_TITLE": "📧 НАПИСАТЬ РАЗРАБОТЧИКУ"
|
||||
},
|
||||
"TTA_MODE": {
|
||||
"TITLE": "Режим TTA",
|
||||
"DESCRIPTION": "Включите тестовое временное увеличение для получения лучших результатов, таких как удаление артефактов, НО это увеличит время обработки в 8 раз!"
|
||||
}
|
||||
},
|
||||
"APP": {
|
||||
|
||||
@@ -93,6 +93,10 @@
|
||||
"TITLE": "有问题吗?",
|
||||
"DOCS_BUTTON_TITLE": "🙏 获取帮助",
|
||||
"EMAIL_BUTTON_TITLE": "📧 联系开发者"
|
||||
},
|
||||
"TTA_MODE": {
|
||||
"TITLE": "TTA 模式",
|
||||
"DESCRIPTION": "启用测试时间增强以获得更好的结果,例如去除伪影,但这会使处理时间增加 8 倍!"
|
||||
}
|
||||
},
|
||||
"APP": {
|
||||
|
||||
Reference in New Issue
Block a user