mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): rename ad-hoc upscale stuff to post-processing
This commit is contained in:
parent
94b5b2a467
commit
a26f050cbb
@ -636,9 +636,9 @@
|
|||||||
"title": "Undo Stroke"
|
"title": "Undo Stroke"
|
||||||
},
|
},
|
||||||
"unifiedCanvasHotkeys": "Unified Canvas",
|
"unifiedCanvasHotkeys": "Unified Canvas",
|
||||||
"upscale": {
|
"postProcess": {
|
||||||
"desc": "Upscale the current image",
|
"desc": "Process the current image using the selected post-processing model",
|
||||||
"title": "Upscale"
|
"title": "Process Image"
|
||||||
},
|
},
|
||||||
"toggleViewer": {
|
"toggleViewer": {
|
||||||
"desc": "Switches between the Image Viewer and workspace for the current tab.",
|
"desc": "Switches between the Image Viewer and workspace for the current tab.",
|
||||||
@ -1035,8 +1035,8 @@
|
|||||||
"symmetry": "Symmetry",
|
"symmetry": "Symmetry",
|
||||||
"tileSize": "Tile Size",
|
"tileSize": "Tile Size",
|
||||||
"type": "Type",
|
"type": "Type",
|
||||||
"upscale": "Upscale (Shift + U)",
|
"postProcessing": "Post-Processing (Shift + U)",
|
||||||
"upscaleImage": "Upscale Image",
|
"processImage": "Process Image",
|
||||||
"upscaling": "Upscaling",
|
"upscaling": "Upscaling",
|
||||||
"useAll": "Use All",
|
"useAll": "Use All",
|
||||||
"useSize": "Use Size",
|
"useSize": "Use Size",
|
||||||
@ -1645,8 +1645,9 @@
|
|||||||
"creativity": "Creativity",
|
"creativity": "Creativity",
|
||||||
"structure": "Structure",
|
"structure": "Structure",
|
||||||
"upscaleModel": "Upscale Model",
|
"upscaleModel": "Upscale Model",
|
||||||
|
"postProcessingModel": "Post-Processing Model",
|
||||||
"scale": "Scale",
|
"scale": "Scale",
|
||||||
"simpleUpscaleMissingModelWarning": "Visit the <LinkComponent>Model Manager</LinkComponent> to install an upscale (image to image) model.",
|
"simpleUpscaleMissingModelWarning": "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",
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
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 { memo, useCallback, useMemo } from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { useSpandrelImageToImageModels } from 'services/api/hooks/modelsByType';
|
||||||
|
import type { SpandrelImageToImageModelConfig } from 'services/api/types';
|
||||||
|
|
||||||
|
const ParamPostProcessingModel = () => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const [modelConfigs, { isLoading }] = useSpandrelImageToImageModels();
|
||||||
|
|
||||||
|
const model = useAppSelector((s) => s.upscale.simpleUpscaleModel);
|
||||||
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
|
const tooltipLabel = useMemo(() => {
|
||||||
|
if (!modelConfigs.length || !model) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return modelConfigs.find((m) => m.key === model?.key)?.description;
|
||||||
|
}, [modelConfigs, model]);
|
||||||
|
|
||||||
|
const _onChange = useCallback(
|
||||||
|
(v: SpandrelImageToImageModelConfig | null) => {
|
||||||
|
dispatch(simpleUpscaleModelChanged(v));
|
||||||
|
},
|
||||||
|
[dispatch]
|
||||||
|
);
|
||||||
|
|
||||||
|
const { options, value, onChange, placeholder, noOptionsMessage } = useModelCombobox({
|
||||||
|
modelConfigs,
|
||||||
|
onChange: _onChange,
|
||||||
|
selectedModel: model,
|
||||||
|
isLoading,
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<FormControl orientation="vertical">
|
||||||
|
<FormLabel>{t('upscaling.postProcessingModel')}</FormLabel>
|
||||||
|
<Tooltip label={tooltipLabel}>
|
||||||
|
<Box w="full">
|
||||||
|
<Combobox
|
||||||
|
value={value}
|
||||||
|
placeholder={placeholder}
|
||||||
|
options={options}
|
||||||
|
onChange={onChange}
|
||||||
|
noOptionsMessage={noOptionsMessage}
|
||||||
|
isDisabled={options.length === 0}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
</Tooltip>
|
||||||
|
</FormControl>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default memo(ParamPostProcessingModel);
|
@ -1,21 +1,17 @@
|
|||||||
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, upscaleModelChanged } from 'features/parameters/store/upscaleSlice';
|
import { upscaleModelChanged } 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';
|
||||||
import type { SpandrelImageToImageModelConfig } from 'services/api/types';
|
import type { SpandrelImageToImageModelConfig } from 'services/api/types';
|
||||||
|
|
||||||
interface Props {
|
const ParamSpandrelModel = () => {
|
||||||
isMultidiffusion: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
const ParamSpandrelModel = ({ isMultidiffusion }: Props) => {
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [modelConfigs, { isLoading }] = useSpandrelImageToImageModels();
|
const [modelConfigs, { isLoading }] = useSpandrelImageToImageModels();
|
||||||
|
|
||||||
const model = useAppSelector((s) => (isMultidiffusion ? s.upscale.upscaleModel : s.upscale.simpleUpscaleModel));
|
const model = useAppSelector((s) => s.upscale.upscaleModel);
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
const tooltipLabel = useMemo(() => {
|
const tooltipLabel = useMemo(() => {
|
||||||
@ -27,13 +23,9 @@ const ParamSpandrelModel = ({ isMultidiffusion }: Props) => {
|
|||||||
|
|
||||||
const _onChange = useCallback(
|
const _onChange = useCallback(
|
||||||
(v: SpandrelImageToImageModelConfig | null) => {
|
(v: SpandrelImageToImageModelConfig | null) => {
|
||||||
if (isMultidiffusion) {
|
|
||||||
dispatch(upscaleModelChanged(v));
|
dispatch(upscaleModelChanged(v));
|
||||||
} else {
|
|
||||||
dispatch(simpleUpscaleModelChanged(v));
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
[isMultidiffusion, dispatch]
|
[dispatch]
|
||||||
);
|
);
|
||||||
|
|
||||||
const { options, value, onChange, placeholder, noOptionsMessage } = useModelCombobox({
|
const { options, value, onChange, placeholder, noOptionsMessage } = useModelCombobox({
|
||||||
|
@ -12,6 +12,7 @@ import {
|
|||||||
import { upscaleRequested } from 'app/store/middleware/listenerMiddleware/listeners/upscaleRequested';
|
import { upscaleRequested } from 'app/store/middleware/listenerMiddleware/listeners/upscaleRequested';
|
||||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||||
import { $installModelsTab } from 'features/modelManagerV2/subpanels/InstallModels';
|
import { $installModelsTab } from 'features/modelManagerV2/subpanels/InstallModels';
|
||||||
|
import ParamPostProcessingModel from 'features/parameters/components/Upscale/ParamPostProcessingModel';
|
||||||
import { useIsQueueMutationInProgress } from 'features/queue/hooks/useIsQueueMutationInProgress';
|
import { useIsQueueMutationInProgress } from 'features/queue/hooks/useIsQueueMutationInProgress';
|
||||||
import { setActiveTab } from 'features/ui/store/uiSlice';
|
import { setActiveTab } from 'features/ui/store/uiSlice';
|
||||||
import { memo, useCallback } from 'react';
|
import { memo, useCallback } from 'react';
|
||||||
@ -19,7 +20,6 @@ import { Trans, useTranslation } from 'react-i18next';
|
|||||||
import { PiFrameCornersBold } from 'react-icons/pi';
|
import { PiFrameCornersBold } from 'react-icons/pi';
|
||||||
import type { ImageDTO } from 'services/api/types';
|
import type { ImageDTO } from 'services/api/types';
|
||||||
|
|
||||||
import ParamSpandrelModel from './ParamSpandrelModel';
|
|
||||||
|
|
||||||
type Props = { imageDTO?: ImageDTO };
|
type Props = { imageDTO?: ImageDTO };
|
||||||
|
|
||||||
@ -43,19 +43,19 @@ const ParamUpscalePopover = (props: Props) => {
|
|||||||
<Popover isOpen={isOpen} onClose={onClose} isLazy>
|
<Popover isOpen={isOpen} onClose={onClose} isLazy>
|
||||||
<PopoverTrigger>
|
<PopoverTrigger>
|
||||||
<IconButton
|
<IconButton
|
||||||
tooltip={t('parameters.upscale')}
|
tooltip={t('parameters.postProcessing')}
|
||||||
onClick={onOpen}
|
onClick={onOpen}
|
||||||
icon={<PiFrameCornersBold />}
|
icon={<PiFrameCornersBold />}
|
||||||
aria-label={t('parameters.upscale')}
|
aria-label={t('parameters.postProcessing')}
|
||||||
/>
|
/>
|
||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
<PopoverContent>
|
<PopoverContent>
|
||||||
<PopoverBody w={96}>
|
<PopoverBody w={96}>
|
||||||
<Flex flexDirection="column" gap={4}>
|
<Flex flexDirection="column" gap={4}>
|
||||||
<ParamSpandrelModel isMultidiffusion={false} />
|
<ParamPostProcessingModel />
|
||||||
{!simpleUpscaleModel && <MissingModelWarning />}
|
{!simpleUpscaleModel && <MissingModelWarning />}
|
||||||
<Button size="sm" isDisabled={!imageDTO || inProgress || !simpleUpscaleModel} onClick={handleClickUpscale}>
|
<Button size="sm" isDisabled={!imageDTO || inProgress || !simpleUpscaleModel} onClick={handleClickUpscale}>
|
||||||
{t('parameters.upscaleImage')}
|
{t('parameters.processImage')}
|
||||||
</Button>
|
</Button>
|
||||||
</Flex>
|
</Flex>
|
||||||
</PopoverBody>
|
</PopoverBody>
|
||||||
|
@ -102,8 +102,8 @@ export const useHotkeyData = (): HotkeyGroup[] => {
|
|||||||
hotkeys: [['A']],
|
hotkeys: [['A']],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('hotkeys.upscale.title'),
|
title: t('hotkeys.postProcess.title'),
|
||||||
desc: t('hotkeys.upscale.desc'),
|
desc: t('hotkeys.postProcess.desc'),
|
||||||
hotkeys: [['Shift', 'U']],
|
hotkeys: [['Shift', 'U']],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user