Merge branch 'main' of github.com:hmartiro/riffusion-app

This commit is contained in:
Hayk Martiros 2022-11-24 00:00:18 -08:00
commit 25bc5813a6
4 changed files with 34 additions and 24 deletions

View File

@ -2,12 +2,13 @@ import { NextComponentType } from 'next'
interface PromptEntryProps { interface PromptEntryProps {
prompt: string prompt: string
className: string
} }
const PromptEntry = (props: PromptEntryProps) => { const PromptEntry = (props: PromptEntryProps) => {
return ( return (
<> <>
<p className="pb-32 text-lg text-gray-400"> <p className={props.className}>
{props.prompt} {props.prompt}
</p> </p>
</> </>

View File

@ -3,7 +3,7 @@ import PromptEntry from './PromptEntry'
import { PromptInput } from "../types"; import { PromptInput } from "../types";
interface PromptPanelProps { interface PromptPanelProps {
prompts: PromptInput[]; prompts: PromptInput[];
addPrompt: (prompt: string, seed: number) => void; addPrompt: (prompt: string) => void;
} }
const PromptPanel = (props: PromptPanelProps) => { const PromptPanel = (props: PromptPanelProps) => {
@ -14,27 +14,36 @@ const PromptPanel = (props: PromptPanelProps) => {
<> <>
<main className="w-2/3 min-h-screen p-4"> <main className="w-2/3 min-h-screen p-4">
<div className="pl-20 pt-10"> <div className="pl-20 pt-10">
<PromptEntry prompt={"yo"}/> {prompts.map((prompt, index) => (
<p className="pb-32 text-xl text-gray-300"> <PromptEntry prompt={prompt.prompt} className={promptEntryClassNames[index]} key={index} />
Taylor Swift singing with a tropical beat ))}
</p>
<p className="pb-32 text-3xl text-white">Justin Bieber Anger Rap</p> <form onSubmit={(e) => {
<p className="pb-32 text-m text-gray-400"> e.preventDefault();
new york city rap, with a dust storm, cinematic score, dramatic, const prompt = e.currentTarget.prompt.value;
composition, tons of energy, brutalistic addPrompt(prompt);
</p> }}>
<input
className="fixed z-90 bottom-20 w-1/2 h-12 pl-3 text-xl text-black rounded-lg border-sky-500 border-2"
type="text"
id="prompt"
name="prompt"
placeholder="What do you want to hear?"
/>
</form>
</div> </div>
</main> </main>
<input
className="fixed z-90 bottom-20 right-40 w-1/2 h-12 pl-3 text-xl text-black"
type="text"
id="prompt"
name="prompt"
placeholder="What do you want to hear?"
/>
</> </>
) )
} }
export default PromptPanel export default PromptPanel
// WIP manner of passing ideal font of each promptEntry based on where it is in the promptPanel. Could be done better with a map or something.
// need not just order, but some context of where we are in time, and when that prompt will be primary (some global step state)
const promptEntryClassNames = {
0: "pb-32 text-lg text-gray-400",
1: "pb-32 text-xl text-gray-300",
2: "pb-32 text-3xl text-white",
3: "pb-32 text-m text-gray-400",
}

View File

@ -11,8 +11,8 @@ import { InferenceResult, PromptInput } from "../types";
import * as Tone from "tone"; import * as Tone from "tone";
const defaultPromptInputs = [ const defaultPromptInputs = [
{ prompt: "A jazz pianist playing a classical concerto", seed: 10 }, { prompt: "A jazz pianist playing a classical concerto"},
{ prompt: "Taylor Swift singing with a tropical beat", seed: 10 }, { prompt: "Taylor Swift singing with a tropical beat"},
]; ];
const defaultInferenceResults = [ const defaultInferenceResults = [
@ -101,8 +101,8 @@ export default function Home() {
<PromptPanel <PromptPanel
prompts={promptInputs} prompts={promptInputs}
addPrompt={(prompt: string, seed: number) => { addPrompt={(prompt: string) => {
setPromptInputs([...promptInputs, { prompt: prompt, seed: seed }]); setPromptInputs([...promptInputs, { prompt: prompt}]);
}} }}
/> />

View File

@ -1,6 +1,6 @@
export interface PromptInput { export interface PromptInput {
prompt: string; prompt: string;
seed: number; seed?: number;
denoising?: number; denoising?: number;
guidance?: number; guidance?: number;
} }