diff --git a/components/AudioPlayer.tsx b/components/AudioPlayer.tsx index 865cca0..f4f687d 100644 --- a/components/AudioPlayer.tsx +++ b/components/AudioPlayer.tsx @@ -132,6 +132,7 @@ export default function AudioPlayer({ resultCounter, inferenceResults, paused, + nowPlayingCallback, tonePlayer, ]); diff --git a/components/ModelInference.tsx b/components/ModelInference.tsx index 2965a34..af6e0a6 100644 --- a/components/ModelInference.tsx +++ b/components/ModelInference.tsx @@ -1,6 +1,5 @@ import { useRouter } from "next/router"; import { useCallback, useEffect, useState } from "react"; -import { useInterval } from "usehooks-ts"; import { AppState, @@ -18,7 +17,6 @@ interface ModelInferenceProps { appState: AppState; promptInputs: PromptInput[]; nowPlayingResult: InferenceResult; - paused: boolean; newResultCallback: (input: InferenceInput, result: InferenceResult) => void; } @@ -33,7 +31,6 @@ export default function ModelInference({ appState, promptInputs, nowPlayingResult, - paused, newResultCallback, }: ModelInferenceProps) { // Create parameters for the inference request @@ -142,10 +139,12 @@ export default function ModelInference({ numInferenceSteps, seedImageId, newResultCallback, + numRequestsMade, + numResponsesReceived, ] ); - // Kick off the first inference run when everything is ready. + // Kick off inference requests useEffect(() => { // Make sure things are initialized properly if ( @@ -157,8 +156,10 @@ export default function ModelInference({ } if (numRequestsMade == 0) { + // Kick off the first request runInference(alpha, seed, appState, promptInputs); } else if (numRequestsMade == numResponsesReceived) { + // Otherwise buffer ahead a few from where the audio player currently is // TODO(hayk): Replace this with better buffer management const nowPlayingCounter = nowPlayingResult ? nowPlayingResult.counter : 0; @@ -170,12 +171,13 @@ export default function ModelInference({ } }, [ initializedUrlParams, - numRequestsMade, alpha, seed, appState, promptInputs, - paused, + nowPlayingResult, + numRequestsMade, + numResponsesReceived, runInference, ]); diff --git a/components/PageHead.tsx b/components/PageHead.tsx new file mode 100644 index 0000000..845fe38 --- /dev/null +++ b/components/PageHead.tsx @@ -0,0 +1,14 @@ +import Head from "next/head"; + +export default function PageHead() { + return ( + + Riffusion + + + + ); +} diff --git a/pages/index.tsx b/pages/index.tsx index 220b72a..d4c973d 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,9 +1,9 @@ -import Head from "next/head"; import { useRouter } from "next/router"; import { useEffect, useState } from "react"; import * as Tone from "tone"; import AudioPlayer from "../components/AudioPlayer"; +import PageHead from "../components/PageHead"; import Info from "../components/Info"; import ModelInference from "../components/ModelInference"; import Pause from "../components/Pause"; @@ -156,14 +156,7 @@ export default function Home() { return ( <> - - Riffusion - - - +
@@ -179,7 +172,6 @@ export default function Home() { seed={seed} appState={appState} promptInputs={promptInputs} - paused={paused} nowPlayingResult={nowPlayingResult} newResultCallback={newResultCallback} />