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'
|
||||
|
||||
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 (
|
||||
<>
|
||||
|
|
|
@ -1,16 +1,24 @@
|
|||
import Head from "next/head";
|
||||
import { useState } from "react";
|
||||
|
||||
|
||||
import ThreeCanvas from "../components/ThreeCanvas";
|
||||
import PromptPanel from "../components/PromptPanel";
|
||||
import Settings from '../components/Settings'
|
||||
import Pause from '../components/Pause'
|
||||
import Settings from "../components/Settings";
|
||||
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() {
|
||||
|
||||
const [paused, setPaused] = useState(false);
|
||||
|
||||
const [promptInputs, setPromptInputs] =
|
||||
useState<PromptInput[]>(defaultPromptInputs);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
|
@ -27,12 +35,16 @@ export default function Home() {
|
|||
<ThreeCanvas paused={paused} />
|
||||
</div>
|
||||
|
||||
<PromptPanel />
|
||||
<PromptPanel
|
||||
prompts={promptInputs}
|
||||
addPrompt={(prompt: string, seed: number) => {
|
||||
setPromptInputs([...promptInputs, { prompt: prompt, seed: seed }]);
|
||||
}}
|
||||
/>
|
||||
|
||||
<Settings />
|
||||
|
||||
<Pause paused={paused} setPaused={setPaused} />
|
||||
|
||||
</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