mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-02-18 22:54:39 -05:00
cleanup esrgan frontend code
This commit is contained in:
@@ -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: [],
|
||||
};
|
||||
Reference in New Issue
Block a user