Add prompt input state
This commit is contained in:
parent
23f1e62608
commit
1c575a84de
|
@ -1,7 +1,14 @@
|
||||||
import { NextComponentType } from 'next'
|
|
||||||
import PromptEntry from './PromptEntry'
|
import PromptEntry from './PromptEntry'
|
||||||
|
|
||||||
const PromptPanel: NextComponentType = () => {
|
import { PromptInput } from "../types";
|
||||||
|
interface PromptPanelProps {
|
||||||
|
prompts: PromptInput[];
|
||||||
|
addPrompt: (prompt: string, seed: number) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const PromptPanel = (props: PromptPanelProps) => {
|
||||||
|
const prompts = props.prompts;
|
||||||
|
const addPrompt = props.addPrompt;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
|
@ -1,16 +1,24 @@
|
||||||
import Head from "next/head";
|
import Head from "next/head";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
|
|
||||||
import ThreeCanvas from "../components/ThreeCanvas";
|
import ThreeCanvas from "../components/ThreeCanvas";
|
||||||
import PromptPanel from "../components/PromptPanel";
|
import PromptPanel from "../components/PromptPanel";
|
||||||
import Settings from '../components/Settings'
|
import Settings from "../components/Settings";
|
||||||
import Pause from '../components/Pause'
|
import Pause from "../components/Pause";
|
||||||
|
|
||||||
|
import { InferenceResult, PromptInput } from "../types";
|
||||||
|
|
||||||
|
const defaultPromptInputs = [
|
||||||
|
{ prompt: "A jazz pianist playing a classical concerto", seed: 10 },
|
||||||
|
{ prompt: "Taylor Swift singing with a tropical beat", seed: 10 },
|
||||||
|
];
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
|
|
||||||
const [paused, setPaused] = useState(false);
|
const [paused, setPaused] = useState(false);
|
||||||
|
|
||||||
|
const [promptInputs, setPromptInputs] =
|
||||||
|
useState<PromptInput[]>(defaultPromptInputs);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Head>
|
<Head>
|
||||||
|
@ -27,12 +35,16 @@ export default function Home() {
|
||||||
<ThreeCanvas paused={paused} />
|
<ThreeCanvas paused={paused} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<PromptPanel />
|
<PromptPanel
|
||||||
|
prompts={promptInputs}
|
||||||
|
addPrompt={(prompt: string, seed: number) => {
|
||||||
|
setPromptInputs([...promptInputs, { prompt: prompt, seed: seed }]);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
<Settings />
|
<Settings />
|
||||||
|
|
||||||
<Pause paused={paused} setPaused={setPaused} />
|
<Pause paused={paused} setPaused={setPaused} />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
export interface PromptInput {
|
||||||
|
prompt: string;
|
||||||
|
seed: number;
|
||||||
|
denoising?: number;
|
||||||
|
guidance?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface InferenceInput {
|
||||||
|
alpha: number;
|
||||||
|
// num_inference_steps: number;
|
||||||
|
// seed_image_id: number;
|
||||||
|
|
||||||
|
start: PromptInput;
|
||||||
|
end: PromptInput;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface InferenceResult {
|
||||||
|
input: InferenceInput;
|
||||||
|
|
||||||
|
// URL of the image
|
||||||
|
image: string;
|
||||||
|
|
||||||
|
// URL of the audio
|
||||||
|
audio: string;
|
||||||
|
}
|
Loading…
Reference in New Issue