feat: generate random seed for image generation in usepaintings hook
This commit is contained in:
parent
494d52ac85
commit
3717ff25bf
@ -8,6 +8,7 @@ import { uuid } from '@renderer/utils'
|
|||||||
export function usePaintings() {
|
export function usePaintings() {
|
||||||
const paintings = useAppSelector((state) => state.paintings.paintings)
|
const paintings = useAppSelector((state) => state.paintings.paintings)
|
||||||
const dispatch = useAppDispatch()
|
const dispatch = useAppDispatch()
|
||||||
|
const generateRandomSeed = () => Math.floor(Math.random() * 1000000).toString()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
paintings,
|
paintings,
|
||||||
@ -20,7 +21,7 @@ export function usePaintings() {
|
|||||||
negativePrompt: '',
|
negativePrompt: '',
|
||||||
imageSize: '1024x1024',
|
imageSize: '1024x1024',
|
||||||
numImages: 1,
|
numImages: 1,
|
||||||
seed: '',
|
seed: generateRandomSeed(),
|
||||||
steps: 25,
|
steps: 25,
|
||||||
guidanceScale: 4.5,
|
guidanceScale: 4.5,
|
||||||
model: TEXT_TO_IMAGES_MODELS[0].id
|
model: TEXT_TO_IMAGES_MODELS[0].id
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { PlusOutlined, QuestionCircleOutlined } from '@ant-design/icons'
|
import { PlusOutlined, QuestionCircleOutlined, RedoOutlined } from '@ant-design/icons'
|
||||||
import ImageSize1_1 from '@renderer/assets/images/paintings/image-size-1-1.svg'
|
import ImageSize1_1 from '@renderer/assets/images/paintings/image-size-1-1.svg'
|
||||||
import ImageSize1_2 from '@renderer/assets/images/paintings/image-size-1-2.svg'
|
import ImageSize1_2 from '@renderer/assets/images/paintings/image-size-1-2.svg'
|
||||||
import ImageSize3_2 from '@renderer/assets/images/paintings/image-size-3-2.svg'
|
import ImageSize3_2 from '@renderer/assets/images/paintings/image-size-3-2.svg'
|
||||||
@ -308,7 +308,12 @@ const PaintingsPage: FC = () => {
|
|||||||
<Input
|
<Input
|
||||||
value={painting.seed}
|
value={painting.seed}
|
||||||
onChange={(e) => updatePaintingState({ seed: e.target.value })}
|
onChange={(e) => updatePaintingState({ seed: e.target.value })}
|
||||||
suffix={<RefreshIcon onClick={() => updatePaintingState({ seed: '' })} />}
|
suffix={
|
||||||
|
<RedoOutlined
|
||||||
|
onClick={() => updatePaintingState({ seed: Math.floor(Math.random() * 1000000).toString() })}
|
||||||
|
style={{ cursor: 'pointer', color: 'var(--color-text-2)' }}
|
||||||
|
/>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<SettingTitle style={{ marginBottom: 5, marginTop: 15 }}>
|
<SettingTitle style={{ marginBottom: 5, marginTop: 15 }}>
|
||||||
@ -502,7 +507,7 @@ const InfoIcon = styled(QuestionCircleOutlined)`
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const RefreshIcon = styled.span`
|
const RefreshIcon = styled(RedoOutlined)`
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user