Remove local samples

This commit is contained in:
Hayk Martiros 2022-11-26 12:12:40 -08:00
parent ada4ae8624
commit 238c9066bc
3 changed files with 1 additions and 56 deletions

View File

@ -2,6 +2,7 @@ import Head from "next/head";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useInterval, useTimeout } from "usehooks-ts"; import { useInterval, useTimeout } from "usehooks-ts";
import * as Tone from "tone";
import ThreeCanvas from "../components/ThreeCanvas"; import ThreeCanvas from "../components/ThreeCanvas";
import PromptPanel from "../components/PromptPanel"; import PromptPanel from "../components/PromptPanel";
@ -10,8 +11,6 @@ import Pause from "../components/Pause";
import { InferenceResult, PromptInput } from "../types"; import { InferenceResult, PromptInput } from "../types";
import * as Tone from "tone";
// TODO(hayk): Get this into a configuration. // TODO(hayk): Get this into a configuration.
const SERVER_URL = "http://129.146.52.68:3013/run_inference/"; const SERVER_URL = "http://129.146.52.68:3013/run_inference/";
@ -29,19 +28,6 @@ enum AppState {
Transition, Transition,
} }
const urlToBase64 = async (url: string) => {
const data = await fetch(url);
const blob = await data.blob();
return new Promise((resolve) => {
const reader = new FileReader();
reader.readAsDataURL(blob);
reader.onloadend = () => {
const base64data = reader.result;
resolve(base64data);
};
});
};
function getRandomInt(max: number) { function getRandomInt(max: number) {
return Math.floor(Math.random() * max); return Math.floor(Math.random() * max);
} }
@ -126,47 +112,6 @@ export default function Home() {
const [appState, setAppState] = useState<AppState>(AppState.SamePrompt); const [appState, setAppState] = useState<AppState>(AppState.SamePrompt);
// On load, populate the first two prompts from checked-in URLs
useEffect(() => {
// NOTE(hayk): not currently populating initial prompts.
if (true) {
return;
}
if (inferenceResults.length > 0) {
return;
}
const populateDefaults = async () => {
const result1 = {
input: {
alpha: 0.0,
start: defaultPromptInputs[0],
end: defaultPromptInputs[1],
},
image: (await urlToBase64("rap_sample.jpg")) as string,
audio: (await urlToBase64("rap_sample.mp3")) as string,
counter: 0,
};
const result2 = {
input: {
alpha: 0.0,
start: defaultPromptInputs[0],
end: defaultPromptInputs[1],
},
image: (await urlToBase64("pop_sample.jpg")) as string,
audio: (await urlToBase64("pop_sample.mp3")) as string,
counter: 1,
};
console.log(result1);
setInferenceResults([...inferenceResults, result1]);
};
populateDefaults();
}, [inferenceResults]);
// On load, create a player synced to the tone transport // On load, create a player synced to the tone transport
useEffect(() => { useEffect(() => {
if (tonePlayer) { if (tonePlayer) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 805 KiB