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",
"postProcessingModel": "Post-Processing Model",
"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:",
"mainModelDesc": "Main model (SD1.5 or SDXL 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 { calculateNewSize } from 'features/parameters/components/ImageSize/calculateNewSize';
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 { getIsSizeOptimal, getOptimalDimension } from 'features/parameters/util/optimalDimension';
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 { upscaleModel: currentUpscaleModel, simpleUpscaleModel: currentSimpleUpscaleModel } = state.upscale;
const { upscaleModel: currentUpscaleModel, postProcessingModel: currentPostProcessingModel } = state.upscale;
const upscaleModels = models.filter(isSpandrelImageToImageModelConfig);
const firstModel = upscaleModels[0] || null;
@ -198,11 +198,11 @@ const handleSpandrelImageToImageModels: ModelHandler = (models, state, dispatch,
dispatch(upscaleModelChanged(firstModel));
}
const isCurrentSimpleUpscaleModelAvailable = currentSimpleUpscaleModel
? upscaleModels.some((m) => m.key === currentSimpleUpscaleModel.key)
const isCurrentPostProcessingModelAvailable = currentPostProcessingModel
? upscaleModels.some((m) => m.key === currentPostProcessingModel.key)
: false;
if (!isCurrentSimpleUpscaleModelAvailable) {
dispatch(simpleUpscaleModelChanged(firstModel));
if (!isCurrentPostProcessingModelAvailable) {
dispatch(postProcessingModelChanged(firstModel));
}
};

View File

@ -16,21 +16,21 @@ type Arg = {
};
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');
g.addNode({
id: SPANDREL,
type: 'spandrel_image_to_image',
image_to_image_model: simpleUpscaleModel,
image_to_image_model: postProcessingModel,
image,
board: getBoardField(state),
is_intermediate: false,
});
const modelConfig = await fetchModelConfigWithTypeGuard(simpleUpscaleModel.key, isSpandrelImageToImageModelConfig);
const modelConfig = await fetchModelConfigWithTypeGuard(postProcessingModel.key, isSpandrelImageToImageModelConfig);
g.upsertMetadata({
upscale_model: getModelMetadataField(modelConfig),

View File

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

View File

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

View File

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