diff --git a/gui/src/components/Profiles.tsx b/gui/src/components/Profiles.tsx index 200dcfef..c09b8b3c 100644 --- a/gui/src/components/Profiles.tsx +++ b/gui/src/components/Profiles.tsx @@ -21,6 +21,7 @@ import { useStore } from 'zustand'; import { BaseImgParams, Txt2ImgParams } from '../client/types.js'; import { StateContext } from '../state.js'; +import { defaultTo } from 'lodash'; export interface ProfilesProps { params: BaseImgParams; @@ -157,12 +158,10 @@ export async function loadParamsFromFile(file: File): Promise> { + const data = JSON.parse(json); + const params: Partial = { + ...data.params, + }; + + const size = defaultTo(data.input_size, data.size); + if (doesExist(size)) { + params.height = size.height; + params.width = size.width; + } + + return params; +} + export function isProbablyJSON(maybeJSON: unknown): maybeJSON is string { return typeof maybeJSON === 'string' && maybeJSON[0] === '{' && maybeJSON[maybeJSON.length - 1] === '}'; }