* Added parameters to new more verbose React app and rebuilt the app.

This commit is contained in:
Peter Baylies 2022-09-17 09:11:29 -04:00
parent c06dc5b85b
commit 0c1a2b68bf
8 changed files with 531 additions and 699 deletions

View File

@ -66,7 +66,6 @@ def create_cmd_parser():
"""
parser = argparse.ArgumentParser(
description='Example: dream> a fantastic alien landscape -W1024 -H960 -s100 -n12',
exit_on_error=True,
)
parser.add_argument('prompt', nargs='?', default='')
parser.add_argument('-s', '--steps', type=int, help='Number of steps')

488
frontend/dist/assets/index.cc197870.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Stable Diffusion Dream Server</title>
<script type="module" crossorigin src="/assets/index.cc5cde43.js"></script>
<script type="module" crossorigin src="/assets/index.cc197870.js"></script>
<link rel="stylesheet" href="/assets/index.447eb2a9.css">
</head>
<body>

View File

@ -21,6 +21,8 @@ export const frontendToBackendParameters = (
iterations,
steps,
cfgScale,
threshold,
perlin,
height,
width,
sampler,
@ -49,6 +51,8 @@ export const frontendToBackendParameters = (
iterations,
steps,
cfg_scale: cfgScale,
threshold,
perlin,
height,
width,
sampler_name: sampler,
@ -111,6 +115,8 @@ export const backendToFrontendParameters = (parameters: {
iterations,
steps,
cfg_scale,
threshold,
perlin,
height,
width,
sampler_name,
@ -171,6 +177,8 @@ export const backendToFrontendParameters = (parameters: {
sd.iterations = iterations;
sd.steps = steps;
sd.cfgScale = cfg_scale;
sd.threshold = threshold;
sd.perlin = perlin;
sd.height = height;
sd.width = width;
sd.sampler = sampler_name;

View File

@ -9,6 +9,8 @@ export interface SDMetadata {
prompt?: string;
steps?: number;
cfgScale?: number;
threshold?: number;
perlin?: number;
height?: number;
width?: number;
sampler?: string;

View File

@ -3,7 +3,7 @@ import { Flex } from '@chakra-ui/react';
import { RootState } from '../../app/store';
import { useAppDispatch, useAppSelector } from '../../app/hooks';
import { setCfgScale, setSampler, setSteps, SDState } from '../sd/sdSlice';
import { setCfgScale, setSampler, setThreshold, setPerlin, setSteps, SDState } from '../sd/sdSlice';
import SDNumberInput from '../../components/SDNumberInput';
import SDSelect from '../../components/SDSelect';
@ -19,6 +19,8 @@ const sdSelector = createSelector(
steps: sd.steps,
cfgScale: sd.cfgScale,
sampler: sd.sampler,
threshold: sd.threshold,
perlin: sd.perlin,
};
},
{
@ -29,7 +31,7 @@ const sdSelector = createSelector(
);
const SamplerOptions = () => {
const { steps, cfgScale, sampler } = useAppSelector(sdSelector);
const { steps, cfgScale, sampler, threshold, perlin } = useAppSelector(sdSelector);
const dispatch = useAppDispatch();
@ -55,6 +57,18 @@ const SamplerOptions = () => {
onChange={(e) => dispatch(setSampler(e.target.value))}
validValues={SAMPLERS}
/>
<SDNumberInput
label='Threshold'
step={0.1}
onChange={(v) => dispatch(setThreshold(Number(v)))}
value={threshold}
/>
<SDNumberInput
label='Perlin'
step={0.1}
onChange={(v) => dispatch(setPerlin(Number(v)))}
value={perlin}
/>
</Flex>
);
};

View File

@ -23,6 +23,8 @@ export interface SDState {
height: number;
width: number;
sampler: string;
threshold: number;
perlin: number;
seed: number;
img2imgStrength: number;
gfpganStrength: number;
@ -50,6 +52,8 @@ const initialSDState: SDState = {
height: 512,
width: 512,
sampler: 'k_lms',
threshold: 0,
perlin: 0,
seed: 0,
seamless: false,
shouldUseInitImage: false,
@ -93,6 +97,12 @@ export const sdSlice = createSlice({
setCfgScale: (state, action: PayloadAction<number>) => {
state.cfgScale = action.payload;
},
setThreshold: (state, action: PayloadAction<number>) => {
state.threshold = action.payload;
},
setPerlin: (state, action: PayloadAction<number>) => {
state.perlin = action.payload;
},
setHeight: (state, action: PayloadAction<number>) => {
state.height = action.payload;
},
@ -182,6 +192,8 @@ export const sdSlice = createSlice({
prompt,
steps,
cfgScale,
threshold,
perlin,
height,
width,
sampler,
@ -201,6 +213,8 @@ export const sdSlice = createSlice({
state.prompt = prompt ?? state.prompt;
state.steps = steps || state.steps;
state.cfgScale = cfgScale || state.cfgScale;
state.threshold = threshold || state.threshold;
state.perlin = perlin || state.perlin;
state.width = width || state.width;
state.height = height || state.height;
state.sampler = sampler || state.sampler;
@ -254,6 +268,8 @@ export const {
setIterations,
setSteps,
setCfgScale,
setThreshold,
setPerlin,
setHeight,
setWidth,
setSampler,