mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
cleanup esrgan frontend code
This commit is contained in:
parent
c098edc6b2
commit
a2f49ef7c1
@ -25,7 +25,6 @@ import { nodesPersistConfig, nodesSlice, nodesUndoableConfig } from 'features/no
|
||||
import { workflowSettingsPersistConfig, workflowSettingsSlice } from 'features/nodes/store/workflowSettingsSlice';
|
||||
import { workflowPersistConfig, workflowSlice } from 'features/nodes/store/workflowSlice';
|
||||
import { generationPersistConfig, generationSlice } from 'features/parameters/store/generationSlice';
|
||||
import { postprocessingPersistConfig, postprocessingSlice } from 'features/parameters/store/postprocessingSlice';
|
||||
import { upscalePersistConfig, upscaleSlice } from 'features/parameters/store/upscaleSlice';
|
||||
import { queueSlice } from 'features/queue/store/queueSlice';
|
||||
import { sdxlPersistConfig, sdxlSlice } from 'features/sdxl/store/sdxlSlice';
|
||||
@ -53,7 +52,6 @@ const allReducers = {
|
||||
[gallerySlice.name]: gallerySlice.reducer,
|
||||
[generationSlice.name]: generationSlice.reducer,
|
||||
[nodesSlice.name]: undoable(nodesSlice.reducer, nodesUndoableConfig),
|
||||
[postprocessingSlice.name]: postprocessingSlice.reducer,
|
||||
[systemSlice.name]: systemSlice.reducer,
|
||||
[configSlice.name]: configSlice.reducer,
|
||||
[uiSlice.name]: uiSlice.reducer,
|
||||
@ -104,7 +102,6 @@ const persistConfigs: { [key in keyof typeof allReducers]?: PersistConfig } = {
|
||||
[galleryPersistConfig.name]: galleryPersistConfig,
|
||||
[generationPersistConfig.name]: generationPersistConfig,
|
||||
[nodesPersistConfig.name]: nodesPersistConfig,
|
||||
[postprocessingPersistConfig.name]: postprocessingPersistConfig,
|
||||
[systemPersistConfig.name]: systemPersistConfig,
|
||||
[workflowPersistConfig.name]: workflowPersistConfig,
|
||||
[uiPersistConfig.name]: uiPersistConfig,
|
||||
|
@ -37,4 +37,4 @@ export const buildAdHocUpscaleGraph = ({ image, state }: Arg): Graph => {
|
||||
});
|
||||
|
||||
return graph;
|
||||
};
|
||||
};
|
||||
|
@ -36,7 +36,6 @@ export const CONTROL_NET_COLLECT = 'control_net_collect';
|
||||
export const IP_ADAPTER_COLLECT = 'ip_adapter_collect';
|
||||
export const T2I_ADAPTER_COLLECT = 't2i_adapter_collect';
|
||||
export const METADATA = 'core_metadata';
|
||||
export const ESRGAN = 'esrgan';
|
||||
export const SPANDREL = 'spandrel';
|
||||
export const SDXL_MODEL_LOADER = 'sdxl_model_loader';
|
||||
export const SDXL_DENOISE_LATENTS = 'sdxl_denoise_latents';
|
||||
|
@ -43,4 +43,4 @@ const ParamSimpleUpscale = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default memo(ParamSimpleUpscale);
|
||||
export default memo(ParamSimpleUpscale);
|
||||
|
@ -1,53 +0,0 @@
|
||||
import type { PayloadAction } from '@reduxjs/toolkit';
|
||||
import { createSlice } from '@reduxjs/toolkit';
|
||||
import type { PersistConfig, RootState } from 'app/store/store';
|
||||
import { z } from 'zod';
|
||||
|
||||
const zParamESRGANModelName = z.enum([
|
||||
'RealESRGAN_x4plus.pth',
|
||||
'RealESRGAN_x4plus_anime_6B.pth',
|
||||
'ESRGAN_SRx4_DF2KOST_official-ff704c30.pth',
|
||||
'RealESRGAN_x2plus.pth',
|
||||
]);
|
||||
type ParamESRGANModelName = z.infer<typeof zParamESRGANModelName>;
|
||||
export const isParamESRGANModelName = (v: unknown): v is ParamESRGANModelName =>
|
||||
zParamESRGANModelName.safeParse(v).success;
|
||||
|
||||
interface PostprocessingState {
|
||||
_version: 1;
|
||||
esrganModelName: ParamESRGANModelName;
|
||||
}
|
||||
|
||||
const initialPostprocessingState: PostprocessingState = {
|
||||
_version: 1,
|
||||
esrganModelName: 'RealESRGAN_x4plus.pth',
|
||||
};
|
||||
|
||||
export const postprocessingSlice = createSlice({
|
||||
name: 'postprocessing',
|
||||
initialState: initialPostprocessingState,
|
||||
reducers: {
|
||||
esrganModelNameChanged: (state, action: PayloadAction<ParamESRGANModelName>) => {
|
||||
state.esrganModelName = action.payload;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { esrganModelNameChanged } = postprocessingSlice.actions;
|
||||
|
||||
export const selectPostprocessingSlice = (state: RootState) => state.postprocessing;
|
||||
|
||||
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
||||
const migratePostprocessingState = (state: any): any => {
|
||||
if (!('_version' in state)) {
|
||||
state._version = 1;
|
||||
}
|
||||
return state;
|
||||
};
|
||||
|
||||
export const postprocessingPersistConfig: PersistConfig<PostprocessingState> = {
|
||||
name: postprocessingSlice.name,
|
||||
initialState: initialPostprocessingState,
|
||||
migrate: migratePostprocessingState,
|
||||
persistDenylist: [],
|
||||
};
|
Loading…
Reference in New Issue
Block a user