tidy(ui): "simpleUpscale" -> "postProcessing"

This commit is contained in:
psychedelicious 2024-07-24 07:35:52 +10:00
parent a26f050cbb
commit 40b262bcc2
6 changed files with 23 additions and 23 deletions

View File

@ -1647,7 +1647,7 @@
"upscaleModel": "Upscale Model", "upscaleModel": "Upscale Model",
"postProcessingModel": "Post-Processing Model", "postProcessingModel": "Post-Processing Model",
"scale": "Scale", "scale": "Scale",
"simpleUpscaleMissingModelWarning": "Visit the <LinkComponent>Model Manager</LinkComponent> to install a post-processing (image to image) model.", "postProcessingMissingModelWarning": "Visit the <LinkComponent>Model Manager</LinkComponent> to install a post-processing (image to image) model.",
"missingModelsWarning": "Visit the <LinkComponent>Model Manager</LinkComponent> to install the required models:", "missingModelsWarning": "Visit the <LinkComponent>Model Manager</LinkComponent> to install the required models:",
"mainModelDesc": "Main model (SD1.5 or SDXL architecture)", "mainModelDesc": "Main model (SD1.5 or SDXL architecture)",
"tileControlNetModelDesc": "Tile ControlNet model for the chosen main model architecture", "tileControlNetModelDesc": "Tile ControlNet model for the chosen main model architecture",

View File

@ -10,7 +10,7 @@ import { heightChanged, widthChanged } from 'features/controlLayers/store/contro
import { loraRemoved } from 'features/lora/store/loraSlice'; import { loraRemoved } from 'features/lora/store/loraSlice';
import { calculateNewSize } from 'features/parameters/components/ImageSize/calculateNewSize'; import { calculateNewSize } from 'features/parameters/components/ImageSize/calculateNewSize';
import { modelChanged, vaeSelected } from 'features/parameters/store/generationSlice'; import { modelChanged, vaeSelected } from 'features/parameters/store/generationSlice';
import { simpleUpscaleModelChanged, upscaleModelChanged } from 'features/parameters/store/upscaleSlice'; import { postProcessingModelChanged, upscaleModelChanged } from 'features/parameters/store/upscaleSlice';
import { zParameterModel, zParameterVAEModel } from 'features/parameters/types/parameterSchemas'; import { zParameterModel, zParameterVAEModel } from 'features/parameters/types/parameterSchemas';
import { getIsSizeOptimal, getOptimalDimension } from 'features/parameters/util/optimalDimension'; import { getIsSizeOptimal, getOptimalDimension } from 'features/parameters/util/optimalDimension';
import { refinerModelChanged } from 'features/sdxl/store/sdxlSlice'; import { refinerModelChanged } from 'features/sdxl/store/sdxlSlice';
@ -186,7 +186,7 @@ const handleControlAdapterModels: ModelHandler = (models, state, dispatch, _log)
}; };
const handleSpandrelImageToImageModels: ModelHandler = (models, state, dispatch, _log) => { const handleSpandrelImageToImageModels: ModelHandler = (models, state, dispatch, _log) => {
const { upscaleModel: currentUpscaleModel, simpleUpscaleModel: currentSimpleUpscaleModel } = state.upscale; const { upscaleModel: currentUpscaleModel, postProcessingModel: currentPostProcessingModel } = state.upscale;
const upscaleModels = models.filter(isSpandrelImageToImageModelConfig); const upscaleModels = models.filter(isSpandrelImageToImageModelConfig);
const firstModel = upscaleModels[0] || null; const firstModel = upscaleModels[0] || null;
@ -198,11 +198,11 @@ const handleSpandrelImageToImageModels: ModelHandler = (models, state, dispatch,
dispatch(upscaleModelChanged(firstModel)); dispatch(upscaleModelChanged(firstModel));
} }
const isCurrentSimpleUpscaleModelAvailable = currentSimpleUpscaleModel const isCurrentPostProcessingModelAvailable = currentPostProcessingModel
? upscaleModels.some((m) => m.key === currentSimpleUpscaleModel.key) ? upscaleModels.some((m) => m.key === currentPostProcessingModel.key)
: false; : false;
if (!isCurrentSimpleUpscaleModelAvailable) { if (!isCurrentPostProcessingModelAvailable) {
dispatch(simpleUpscaleModelChanged(firstModel)); dispatch(postProcessingModelChanged(firstModel));
} }
}; };

View File

@ -16,21 +16,21 @@ type Arg = {
}; };
export const buildAdHocUpscaleGraph = async ({ image, state }: Arg): Promise<GraphType> => { export const buildAdHocUpscaleGraph = async ({ image, state }: Arg): Promise<GraphType> => {
const { simpleUpscaleModel } = state.upscale; const { postProcessingModel } = state.upscale;
assert(simpleUpscaleModel, 'No upscale model found in state'); assert(postProcessingModel, 'No upscale model found in state');
const g = new Graph('adhoc-upscale-graph'); const g = new Graph('adhoc-upscale-graph');
g.addNode({ g.addNode({
id: SPANDREL, id: SPANDREL,
type: 'spandrel_image_to_image', type: 'spandrel_image_to_image',
image_to_image_model: simpleUpscaleModel, image_to_image_model: postProcessingModel,
image, image,
board: getBoardField(state), board: getBoardField(state),
is_intermediate: false, is_intermediate: false,
}); });
const modelConfig = await fetchModelConfigWithTypeGuard(simpleUpscaleModel.key, isSpandrelImageToImageModelConfig); const modelConfig = await fetchModelConfigWithTypeGuard(postProcessingModel.key, isSpandrelImageToImageModelConfig);
g.upsertMetadata({ g.upsertMetadata({
upscale_model: getModelMetadataField(modelConfig), upscale_model: getModelMetadataField(modelConfig),

View File

@ -1,7 +1,7 @@
import { Box, Combobox, FormControl, FormLabel, Tooltip } from '@invoke-ai/ui-library'; import { Box, Combobox, FormControl, FormLabel, Tooltip } from '@invoke-ai/ui-library';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import { useModelCombobox } from 'common/hooks/useModelCombobox'; import { useModelCombobox } from 'common/hooks/useModelCombobox';
import { simpleUpscaleModelChanged } from 'features/parameters/store/upscaleSlice'; import { postProcessingModelChanged } from 'features/parameters/store/upscaleSlice';
import { memo, useCallback, useMemo } from 'react'; import { memo, useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useSpandrelImageToImageModels } from 'services/api/hooks/modelsByType'; import { useSpandrelImageToImageModels } from 'services/api/hooks/modelsByType';
@ -11,7 +11,7 @@ const ParamPostProcessingModel = () => {
const { t } = useTranslation(); const { t } = useTranslation();
const [modelConfigs, { isLoading }] = useSpandrelImageToImageModels(); const [modelConfigs, { isLoading }] = useSpandrelImageToImageModels();
const model = useAppSelector((s) => s.upscale.simpleUpscaleModel); const model = useAppSelector((s) => s.upscale.postProcessingModel);
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const tooltipLabel = useMemo(() => { const tooltipLabel = useMemo(() => {
@ -23,7 +23,7 @@ const ParamPostProcessingModel = () => {
const _onChange = useCallback( const _onChange = useCallback(
(v: SpandrelImageToImageModelConfig | null) => { (v: SpandrelImageToImageModelConfig | null) => {
dispatch(simpleUpscaleModelChanged(v)); dispatch(postProcessingModelChanged(v));
}, },
[dispatch] [dispatch]
); );

View File

@ -26,7 +26,7 @@ type Props = { imageDTO?: ImageDTO };
const ParamUpscalePopover = (props: Props) => { const ParamUpscalePopover = (props: Props) => {
const { imageDTO } = props; const { imageDTO } = props;
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const { simpleUpscaleModel } = useAppSelector((s) => s.upscale); const { postProcessingModel } = useAppSelector((s) => s.upscale);
const inProgress = useIsQueueMutationInProgress(); const inProgress = useIsQueueMutationInProgress();
const { t } = useTranslation(); const { t } = useTranslation();
const { isOpen, onOpen, onClose } = useDisclosure(); const { isOpen, onOpen, onClose } = useDisclosure();
@ -53,8 +53,8 @@ const ParamUpscalePopover = (props: Props) => {
<PopoverBody w={96}> <PopoverBody w={96}>
<Flex flexDirection="column" gap={4}> <Flex flexDirection="column" gap={4}>
<ParamPostProcessingModel /> <ParamPostProcessingModel />
{!simpleUpscaleModel && <MissingModelWarning />} {!postProcessingModel && <MissingModelWarning />}
<Button size="sm" isDisabled={!imageDTO || inProgress || !simpleUpscaleModel} onClick={handleClickUpscale}> <Button size="sm" isDisabled={!imageDTO || inProgress || !postProcessingModel} onClick={handleClickUpscale}>
{t('parameters.processImage')} {t('parameters.processImage')}
</Button> </Button>
</Flex> </Flex>
@ -78,7 +78,7 @@ const MissingModelWarning = () => {
<Flex bg="error.500" borderRadius="base" padding={4} direction="column" fontSize="sm" gap={2}> <Flex bg="error.500" borderRadius="base" padding={4} direction="column" fontSize="sm" gap={2}>
<Text> <Text>
<Trans <Trans
i18nKey="upscaling.simpleUpscaleMissingModelWarning" i18nKey="upscaling.postProcessingMissingModelWarning"
components={{ components={{
LinkComponent: ( LinkComponent: (
<Button size="sm" flexGrow={0} variant="link" color="base.50" onClick={handleGoToModelManager} /> <Button size="sm" flexGrow={0} variant="link" color="base.50" onClick={handleGoToModelManager} />

View File

@ -12,7 +12,7 @@ interface UpscaleState {
creativity: number; creativity: number;
tileControlnetModel: ControlNetModelConfig | null; tileControlnetModel: ControlNetModelConfig | null;
scale: number; scale: number;
simpleUpscaleModel: ParameterSpandrelImageToImageModel | null; postProcessingModel: ParameterSpandrelImageToImageModel | null;
} }
const initialUpscaleState: UpscaleState = { const initialUpscaleState: UpscaleState = {
@ -23,7 +23,7 @@ const initialUpscaleState: UpscaleState = {
creativity: 0, creativity: 0,
tileControlnetModel: null, tileControlnetModel: null,
scale: 4, scale: 4,
simpleUpscaleModel: null, postProcessingModel: null,
}; };
export const upscaleSlice = createSlice({ export const upscaleSlice = createSlice({
@ -48,8 +48,8 @@ export const upscaleSlice = createSlice({
scaleChanged: (state, action: PayloadAction<number>) => { scaleChanged: (state, action: PayloadAction<number>) => {
state.scale = action.payload; state.scale = action.payload;
}, },
simpleUpscaleModelChanged: (state, action: PayloadAction<ParameterSpandrelImageToImageModel | null>) => { postProcessingModelChanged: (state, action: PayloadAction<ParameterSpandrelImageToImageModel | null>) => {
state.simpleUpscaleModel = action.payload; state.postProcessingModel = action.payload;
}, },
}, },
}); });
@ -61,7 +61,7 @@ export const {
creativityChanged, creativityChanged,
tileControlnetModelChanged, tileControlnetModelChanged,
scaleChanged, scaleChanged,
simpleUpscaleModelChanged, postProcessingModelChanged,
} = upscaleSlice.actions; } = upscaleSlice.actions;
export const selectUpscalelice = (state: RootState) => state.upscale; export const selectUpscalelice = (state: RootState) => state.upscale;