mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
update translations, change config value to be dimension instead of total pixels
This commit is contained in:
committed by
psychedelicious
parent
90ec757802
commit
2cff20f87a
@ -8,14 +8,14 @@ import type { ImageDTO } from 'services/api/types';
|
||||
const createIsTooLargeToUpscaleSelector = (imageDTO?: ImageDTO) =>
|
||||
createMemoizedSelector(selectUpscalelice, selectConfigSlice, (upscale, config) => {
|
||||
const { upscaleModel, scale } = upscale;
|
||||
const { maxUpscalePixels } = config;
|
||||
const { maxUpscaleDimension } = config;
|
||||
|
||||
if (!maxUpscalePixels || !upscaleModel || !imageDTO) {
|
||||
if (!maxUpscaleDimension || !upscaleModel || !imageDTO) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const upscaledPixels = imageDTO.width * scale * imageDTO.height * scale;
|
||||
return upscaledPixels > maxUpscalePixels;
|
||||
return upscaledPixels > maxUpscaleDimension * maxUpscaleDimension;
|
||||
});
|
||||
|
||||
export const useIsTooLargeToUpscale = (imageDTO?: ImageDTO) => {
|
||||
|
@ -18,6 +18,7 @@ export const UpscaleWarning = () => {
|
||||
const [modelConfigs, { isLoading }] = useControlNetModels();
|
||||
const disabledTabs = useAppSelector((s) => s.config.disabledTabs);
|
||||
const shouldShowButton = useMemo(() => !disabledTabs.includes('models'), [disabledTabs]);
|
||||
const maxUpscaleDimension = useAppSelector((s) => s.config.maxUpscaleDimension);
|
||||
const isTooLargeToUpscale = useIsTooLargeToUpscale(upscaleInitialImage || undefined);
|
||||
|
||||
useEffect(() => {
|
||||
@ -43,11 +44,13 @@ export const UpscaleWarning = () => {
|
||||
|
||||
const otherWarnings = useMemo(() => {
|
||||
const _warnings: string[] = [];
|
||||
if (isTooLargeToUpscale) {
|
||||
_warnings.push(t('upscaling.outputTooLarge'));
|
||||
if (isTooLargeToUpscale && maxUpscaleDimension) {
|
||||
_warnings.push(
|
||||
t('upscaling.exceedsMaxSizeDetails', { maxUpscaleDimension: maxUpscaleDimension.toLocaleString() })
|
||||
);
|
||||
}
|
||||
return _warnings;
|
||||
}, [isTooLargeToUpscale, t]);
|
||||
}, [isTooLargeToUpscale, t, maxUpscaleDimension]);
|
||||
|
||||
const handleGoToModelManager = useCallback(() => {
|
||||
dispatch(setActiveTab('models'));
|
||||
|
Reference in New Issue
Block a user