mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-13 05:12:50 +00:00
now default cn and prompts are bound to the sd weight
This commit is contained in:
1 parent
fb6d42ec01
commit
a93a34af0b
8 files changed
+119
-27
No files matched your search
@@ -18,6 +18,7 @@ export function TableOfKeyValues(
|
||||
title: string;
|
||||
keyValues:{
|
||||
[key:string]:number|string|boolean|undefined
|
||||
|{ [key:string]:number|string}
|
||||
};
|
||||
height?: number | string
|
||||
}){
|
||||
@@ -33,7 +34,9 @@ export function TableOfKeyValues(
|
||||
<tr><th>{title}</th></tr>
|
||||
{
|
||||
Object.entries(keyValues).map(([key, val], index: number)=>{
|
||||
return <tr key={index}><td>{`${key}`}</td><td>{`${val}`}</td></tr>
|
||||
if(key!=="defaultCN" && key!=="defaultPrompts")
|
||||
return <tr key={index}><td>{`${key}`}</td><td>{`${val}`}</td></tr>
|
||||
else return null
|
||||
})
|
||||
}
|
||||
</tbody></table>);
|
||||
|
||||
+4
-2
@@ -25,18 +25,20 @@ import {
|
||||
fullbodyPreset,
|
||||
landscapePreset,
|
||||
typogPreset,
|
||||
defaultPreset,
|
||||
// defaultPreset,
|
||||
} from "./dataCnPresets";
|
||||
|
||||
export default function CompAdvanceOptions({
|
||||
debug,
|
||||
debug: propsDebug = false,
|
||||
t,
|
||||
vstValues: vstVal,
|
||||
onChange: handleOnChange,
|
||||
currDefaultCN: defaultPreset
|
||||
}: {
|
||||
debug?: boolean;
|
||||
t: Function;
|
||||
vstValues: VSTType;
|
||||
currDefaultCN: {[key: string]: number};
|
||||
onChange: (val: {
|
||||
[key: string]: number | string | boolean | undefined;
|
||||
}) => void;
|
||||
|
||||
+29
-6
@@ -8,6 +8,7 @@ import { SelectModalV2 } from "components/common/SelectModal";
|
||||
import { WeightCategory } from "@storyteller/components/src/api/_common/enums/WeightCategory";
|
||||
|
||||
import styleModels from './dataStyleModels';
|
||||
import { defaultPreset as noStyleCNPreset } from './dataCnPresets';
|
||||
|
||||
export default function CompStyleModal({
|
||||
debug,
|
||||
@@ -19,7 +20,8 @@ export default function CompStyleModal({
|
||||
t: Function;
|
||||
value: string;
|
||||
onChange: (val: {
|
||||
[key: string]: number | string | boolean | undefined;
|
||||
[key: string]: number | string | boolean | undefined
|
||||
| {[key: string]: number | string };
|
||||
}) => void;
|
||||
}){
|
||||
const gridContainerRef = useRef<HTMLDivElement | null>(null);
|
||||
@@ -34,6 +36,18 @@ export default function CompStyleModal({
|
||||
onClear={()=>onChange({
|
||||
sdModelToken: "",
|
||||
sdModelTitle: "",
|
||||
defaultCN: noStyleCNPreset,
|
||||
defaultPrompts:{
|
||||
positivePrompt:"",
|
||||
negativePrompt:"",
|
||||
positivePromptHidden:"",
|
||||
negativePromptHidden:"",
|
||||
},
|
||||
...noStyleCNPreset,
|
||||
positivePrompt:"",
|
||||
negativePrompt:"",
|
||||
positivePromptHidden:"",
|
||||
negativePromptHidden:"",
|
||||
})}
|
||||
>
|
||||
<MasonryGrid
|
||||
@@ -46,11 +60,20 @@ export default function CompStyleModal({
|
||||
type: "weights",
|
||||
inSelectModal: true,
|
||||
onResultSelect: (data: any)=>{
|
||||
onChange({
|
||||
sdModelToken:data.token,
|
||||
sdModelTitle: data.title,
|
||||
})
|
||||
setOnSelectTimeStamp(new Date());
|
||||
const selectedStyle = styleModels.find(
|
||||
(styleItem)=>styleItem.weight_token = data.token
|
||||
);
|
||||
if(selectedStyle!==undefined){
|
||||
onChange({
|
||||
sdModelToken:data.token,
|
||||
sdModelTitle: data.title,
|
||||
defaultCN: selectedStyle.defaultCN,
|
||||
defaultPrompts: selectedStyle.defaultPrompts,
|
||||
...selectedStyle.defaultCN,
|
||||
...selectedStyle.defaultPrompts
|
||||
});
|
||||
setOnSelectTimeStamp(new Date());
|
||||
}
|
||||
}
|
||||
};
|
||||
//console.log(data);
|
||||
|
||||
+3
-3
@@ -10,13 +10,13 @@ type CNPreset =
|
||||
const defaultPreset = {
|
||||
cnCanny: 0,
|
||||
cnDepth: 0,
|
||||
cnLineArtAnime: 0.7,
|
||||
cnLineArtAnime: 0,
|
||||
cnLineArtRealistic: 0,
|
||||
cnLipsStrength: 0,
|
||||
cnOpenPose: 1,
|
||||
cnOpenPose: 0,
|
||||
cnPipeFace: 0,
|
||||
cnSparseScribble: 0,
|
||||
cnSoftEdge: 1,
|
||||
cnSoftEdge: 0,
|
||||
cnRegularSteps: 20,
|
||||
}
|
||||
|
||||
|
||||
+25
-7
@@ -1,7 +1,9 @@
|
||||
import { defaultPreset as defaultCN } from "./dataCnPresets";
|
||||
// import { defaultPreset as defaultCN } from "./dataCnPresets";
|
||||
import styleModels from "./dataStyleModels";
|
||||
import { VSTType } from "./helpers";
|
||||
export {initialValues, hiddenValues};
|
||||
const initialValues = {
|
||||
|
||||
const initialValues: VSTType = {
|
||||
//files Settings
|
||||
fileToken: "",
|
||||
outputPath: "vid2vid/SparseUpscaleInterp_00001.mp4",
|
||||
@@ -17,17 +19,33 @@ const initialValues = {
|
||||
workflowConfig: "weight_0a04e66y14t4e2bwxjfyg1mb2",
|
||||
sdModelToken: styleModels[0].weight_token,
|
||||
sdModelTitle: styleModels[0].title,
|
||||
loraModelToken: "",
|
||||
loraModelStrength: 0,
|
||||
// loraModelToken: "",
|
||||
// loraModelStrength: 0,
|
||||
|
||||
//basics
|
||||
inputFps: 24,
|
||||
posPrompt: "perfect anime illustration,(best-quality:0.8),",
|
||||
negPrompt: "",
|
||||
...styleModels[0].defaultPrompts,
|
||||
// positivePrompt:"",
|
||||
// negativePrompt:"",
|
||||
// positivePromptHidden:"",
|
||||
// negativePromptHidden:"",
|
||||
visibility: "private",
|
||||
|
||||
//Control Net
|
||||
...defaultCN
|
||||
...styleModels[0].defaultCN,
|
||||
// cnCanny: 0,
|
||||
// cnDepth: 0,
|
||||
// cnLineArtAnime: 0,
|
||||
// cnLineArtRealistic: 0,
|
||||
// cnLipsStrength: 0,
|
||||
// cnOpenPose: 0,
|
||||
// cnPipeFace: 0,
|
||||
// cnSparseScribble: 0,
|
||||
// cnSoftEdge: 0,
|
||||
// cnRegularSteps: 0,
|
||||
|
||||
defaultCN:styleModels[0].defaultCN,
|
||||
defaultPrompts:styleModels[0].defaultPrompts,
|
||||
};
|
||||
|
||||
const hiddenValues = {
|
||||
|
||||
+19
-1
@@ -33,7 +33,25 @@ const styleModels = [
|
||||
"bookmark_count": 1
|
||||
},
|
||||
"created_at": "2024-02-28T21:00:43Z",
|
||||
"updated_at": "2024-02-28T21:00:43Z"
|
||||
"updated_at": "2024-02-28T21:00:43Z",
|
||||
defaultCN:{
|
||||
cnCanny: 0,
|
||||
cnDepth: 0,
|
||||
cnLineArtAnime: 0.7,
|
||||
cnLineArtRealistic: 0,
|
||||
cnLipsStrength: 0,
|
||||
cnOpenPose: 1,
|
||||
cnPipeFace: 0,
|
||||
cnSparseScribble: 0,
|
||||
cnSoftEdge: 1,
|
||||
cnRegularSteps: 20,
|
||||
},
|
||||
defaultPrompts:{
|
||||
positivePrompt:"perfect anime illustration,(best-quality:0.8),",
|
||||
negativePrompt:"",
|
||||
positivePromptHidden:"",
|
||||
negativePromptHidden:"flare, lens flare, glare,naked, nsfw, text, logo, watermark:1.3, letterboxed,embedding:easynegative, embedding:badhandv4,(worst quality, low quality:1.4), lowres, blurry, monochrome, ",
|
||||
}
|
||||
},
|
||||
// {
|
||||
// "weight_token": "weight_vbz0wq7wkv80casj3vfptrrpg",
|
||||
|
||||
+25
-4
@@ -21,8 +21,10 @@ export type VSTType = {
|
||||
|
||||
//basics
|
||||
inputFps: number;
|
||||
posPrompt: string;
|
||||
negPrompt: string;
|
||||
positivePrompt: string;
|
||||
negativePrompt: string;
|
||||
positivePromptHidden:string,
|
||||
negativePromptHidden:string,
|
||||
visibility: string;
|
||||
|
||||
//advance
|
||||
@@ -36,6 +38,25 @@ export type VSTType = {
|
||||
cnSparseScribble: number;
|
||||
cnSoftEdge: number;
|
||||
cnRegularSteps: number
|
||||
|
||||
defaultCN: {
|
||||
cnCanny: number;
|
||||
cnDepth: number;
|
||||
cnLineArtAnime: number;
|
||||
cnLineArtRealistic: number;
|
||||
cnLipsStrength: number;
|
||||
cnOpenPose: number;
|
||||
cnPipeFace: number;
|
||||
cnSparseScribble: number;
|
||||
cnSoftEdge: number;
|
||||
cnRegularSteps: number
|
||||
},
|
||||
defaultPrompts:{
|
||||
positivePrompt:string,
|
||||
negativePrompt:string,
|
||||
positivePromptHidden:string,
|
||||
negativePromptHidden:string,
|
||||
}
|
||||
}
|
||||
|
||||
export function isInputValid(keyValues: {[key:string]:number|string|boolean|undefined}){
|
||||
@@ -61,9 +82,9 @@ export function mapRequest(vstValues: VSTType){
|
||||
"maybe_json_modifications": {
|
||||
"$.154.inputs.Value": vstValues.inputFps,
|
||||
"$.510.inputs.Text":
|
||||
hiddenValues.posPrompt + vstValues.posPrompt,
|
||||
vstValues.positivePromptHidden + vstValues.positivePrompt,
|
||||
"$.8.inputs.text":
|
||||
hiddenValues.negPrompt+ vstValues.negPrompt,
|
||||
vstValues.negativePromptHidden+ vstValues.negativePrompt,
|
||||
|
||||
"$.401.inputs.Value": 0.7, //Denoise First Pass
|
||||
"$.140.inputs.Value": 1, // Every nth frame
|
||||
|
||||
+10
-3
@@ -38,7 +38,13 @@ export default function PageVSTApp({
|
||||
});
|
||||
|
||||
const handleOnChange = (val: {
|
||||
[key: string]: number | string | boolean | undefined;
|
||||
[key: string]:
|
||||
number |
|
||||
string |
|
||||
boolean |
|
||||
undefined |
|
||||
{[key: string]: number | string}
|
||||
;
|
||||
}) => {
|
||||
setVstValues(curr => ({ ...curr, ...val }));
|
||||
};
|
||||
@@ -97,7 +103,7 @@ export default function PageVSTApp({
|
||||
placeholder: t("input.placeholder.prompt"),
|
||||
onChange: (e: React.ChangeEvent<HTMLTextAreaElement>) =>
|
||||
handleOnChange({ posPrompt: e.target.value }),
|
||||
value: vstValues.posPrompt,
|
||||
value: vstValues.positivePrompt,
|
||||
required: false,
|
||||
}}
|
||||
/>
|
||||
@@ -107,7 +113,7 @@ export default function PageVSTApp({
|
||||
placeholder: t("input.placeholder.negPrompt"),
|
||||
onChange: (e: React.ChangeEvent<HTMLTextAreaElement>) =>
|
||||
handleOnChange({ negPrompt: e.target.value }),
|
||||
value: vstValues.negPrompt,
|
||||
value: vstValues.negativePrompt,
|
||||
required: false,
|
||||
}}
|
||||
/>
|
||||
@@ -121,6 +127,7 @@ export default function PageVSTApp({
|
||||
<CompAdvanceOptions
|
||||
debug={debug}
|
||||
t={t}
|
||||
currDefaultCN={vstValues.defaultCN}
|
||||
onChange={handleOnChange}
|
||||
vstValues={vstValues}
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user