Skip to content

Commit 2cff20f

Browse files
Mary Hipppsychedelicious
authored andcommitted
update translations, change config value to be dimension instead of total pixels
1 parent 90ec757 commit 2cff20f

File tree

5 files changed

+15
-12
lines changed

5 files changed

+15
-12
lines changed

invokeai/frontend/web/public/locales/en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,15 +1673,15 @@
16731673
},
16741674
"upscaling": {
16751675
"creativity": "Creativity",
1676+
"exceedsMaxSize": "Upscale settings exceed max size limit",
1677+
"exceedsMaxSizeDetails": "Max upscale limit is {{maxUpscaleDimension}}x{{maxUpscaleDimension}} pixels. Please try a smaller image or decrease your scale selection.",
16761678
"structure": "Structure",
16771679
"upscaleModel": "Upscale Model",
16781680
"postProcessingModel": "Post-Processing Model",
16791681
"scale": "Scale",
16801682
"postProcessingMissingModelWarning": "Visit the <LinkComponent>Model Manager</LinkComponent> to install a post-processing (image to image) model.",
16811683
"missingModelsWarning": "Visit the <LinkComponent>Model Manager</LinkComponent> to install the required models:",
16821684
"mainModelDesc": "Main model (SD1.5 or SDXL architecture)",
1683-
"outputTooLargeShort": "Output is too large to upscale",
1684-
"outputTooLarge": "Max upscale limit is 10,000x10,000 pixels. Please try a smaller image or decrease your scale selection.",
16851685
"tileControlNetModelDesc": "Tile ControlNet model for the chosen main model architecture",
16861686
"upscaleModelDesc": "Upscale (image to image) model",
16871687
"missingUpscaleInitialImage": "Missing initial image for upscaling",

invokeai/frontend/web/src/app/types/invokeai.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export type AppConfig = {
6565
*/
6666
shouldUpdateImagesOnConnect: boolean;
6767
shouldFetchMetadataFromApi: boolean;
68-
maxUpscalePixels?: number;
68+
maxUpscaleDimension?: number;
6969
allowPrivateBoards: boolean;
7070
disabledTabs: InvokeTabName[];
7171
disabledFeatures: AppFeature[];

invokeai/frontend/web/src/common/hooks/useIsReadyToEnqueue.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,11 @@ const createSelector = (templates: Templates) =>
212212
} else if (activeTabName === 'upscaling') {
213213
if (!upscale.upscaleInitialImage) {
214214
reasons.push({ content: i18n.t('upscaling.missingUpscaleInitialImage') });
215-
} else if (config.maxUpscalePixels) {
215+
} else if (config.maxUpscaleDimension) {
216216
const upscaledPixels =
217217
upscale.upscaleInitialImage.width * upscale.scale * upscale.upscaleInitialImage.height * upscale.scale;
218-
if (upscaledPixels > config.maxUpscalePixels) {
219-
reasons.push({ content: i18n.t('upscaling.outputTooLargeShort') });
218+
if (upscaledPixels > config.maxUpscaleDimension) {
219+
reasons.push({ content: i18n.t('upscaling.exceedsMaxSize') });
220220
}
221221
}
222222
if (!upscale.upscaleModel) {

invokeai/frontend/web/src/features/parameters/hooks/useIsTooLargeToUpscale.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ import type { ImageDTO } from 'services/api/types';
88
const createIsTooLargeToUpscaleSelector = (imageDTO?: ImageDTO) =>
99
createMemoizedSelector(selectUpscalelice, selectConfigSlice, (upscale, config) => {
1010
const { upscaleModel, scale } = upscale;
11-
const { maxUpscalePixels } = config;
11+
const { maxUpscaleDimension } = config;
1212

13-
if (!maxUpscalePixels || !upscaleModel || !imageDTO) {
13+
if (!maxUpscaleDimension || !upscaleModel || !imageDTO) {
1414
return false;
1515
}
1616

1717
const upscaledPixels = imageDTO.width * scale * imageDTO.height * scale;
18-
return upscaledPixels > maxUpscalePixels;
18+
return upscaledPixels > maxUpscaleDimension * maxUpscaleDimension;
1919
});
2020

2121
export const useIsTooLargeToUpscale = (imageDTO?: ImageDTO) => {

invokeai/frontend/web/src/features/settingsAccordions/components/UpscaleSettingsAccordion/UpscaleWarning.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const UpscaleWarning = () => {
1818
const [modelConfigs, { isLoading }] = useControlNetModels();
1919
const disabledTabs = useAppSelector((s) => s.config.disabledTabs);
2020
const shouldShowButton = useMemo(() => !disabledTabs.includes('models'), [disabledTabs]);
21+
const maxUpscaleDimension = useAppSelector((s) => s.config.maxUpscaleDimension);
2122
const isTooLargeToUpscale = useIsTooLargeToUpscale(upscaleInitialImage || undefined);
2223

2324
useEffect(() => {
@@ -43,11 +44,13 @@ export const UpscaleWarning = () => {
4344

4445
const otherWarnings = useMemo(() => {
4546
const _warnings: string[] = [];
46-
if (isTooLargeToUpscale) {
47-
_warnings.push(t('upscaling.outputTooLarge'));
47+
if (isTooLargeToUpscale && maxUpscaleDimension) {
48+
_warnings.push(
49+
t('upscaling.exceedsMaxSizeDetails', { maxUpscaleDimension: maxUpscaleDimension.toLocaleString() })
50+
);
4851
}
4952
return _warnings;
50-
}, [isTooLargeToUpscale, t]);
53+
}, [isTooLargeToUpscale, t, maxUpscaleDimension]);
5154

5255
const handleGoToModelManager = useCallback(() => {
5356
dispatch(setActiveTab('models'));

0 commit comments

Comments
 (0)