From 732bfb0e5f0a364dba5fbaa695bf2c6cb2eeaf95 Mon Sep 17 00:00:00 2001 From: Hayk Martiros Date: Thu, 22 Dec 2022 20:27:35 -0800 Subject: [PATCH] Add more prompts and fix flask --- components/ModelInference.tsx | 14 ++++++++------ pages/api/server.js | 2 +- samplePrompts.ts | 26 +++++++++++++++++++++----- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/components/ModelInference.tsx b/components/ModelInference.tsx index 4b59476..a9ced67 100644 --- a/components/ModelInference.tsx +++ b/components/ModelInference.tsx @@ -117,15 +117,20 @@ export default function ModelInference({ setNumRequestsMade((n) => n + 1); // Customize for baseten - const apiHandler = useBaseten ? process.env.NEXT_PUBLIC_RIFFUSION_BASETEN_GC_URL : "/api/server"; + const apiHandler = useBaseten + ? process.env.NEXT_PUBLIC_RIFFUSION_BASETEN_GC_URL + : "/api/server"; const payload = useBaseten ? { worklet_input: inferenceInput } : inferenceInput; + // NOTE(hayk): Clean this up with server.js, there's something fishy going on. + const headers = useBaseten ? { "Content-Type": "application/json" } : {}; + const response = await fetch(apiHandler, { method: "POST", body: JSON.stringify(payload), - headers: { 'Content-Type': 'application/json' } + headers: headers, }); const data = await response.json(); @@ -134,10 +139,7 @@ export default function ModelInference({ if (useBaseten) { if (data?.output) { - newResultCallback( - inferenceInput, - data.output - ); + newResultCallback(inferenceInput, data.output); } else { console.error("Baseten call failed: ", data); } diff --git a/pages/api/server.js b/pages/api/server.js index d9b7a60..8593381 100644 --- a/pages/api/server.js +++ b/pages/api/server.js @@ -1,5 +1,5 @@ export default async function handler(req, res) { - let headers = { + const headers = { "Content-Type": "application/json", "Access-Control-Allow-Origin": "*", }; diff --git a/samplePrompts.ts b/samplePrompts.ts index 441b35d..249797e 100644 --- a/samplePrompts.ts +++ b/samplePrompts.ts @@ -1,24 +1,32 @@ // List of interesting prompts to randomly sample. export const samplePrompts = [ + "a folksy blues song from the mississippi delta around 1910", "acoustic folk violin jam", "ancient chinese hymn", "anger rap", + "arabic gospel vocals", "bongos on a havana street", - "brazilian Forró dance", + "bossa nova with distorted guitar", "bubblegum eurodance", "church bells", "classical italian tenor operatic pop", "copacabana beach", + "deep, smooth synthwave with a dream-like atmosphere", + "emotional disco", "funk bassline with a jazzy saxophone", + "ibiza at 3am", "jamaican dancehall vocals", + "jazzy clarinet with maracas", "jazzy rapping from paris", "k-pop boy group", + "latent space vaporwave", "lo-fi beat for the holidays", - "mambo but from kenya", - "piano concerto in a minor", + "mambo but from Kenya", + "piano concerto in A minor", "post-teen pop talent show winner", "psychedelic nepalese trance", "rock and roll electric guitar solo", + "scott joplin style ragtime piano", "smooth tropical dance jazz", "swing jazz trumpet", "techno DJ and a country fiddle", @@ -28,21 +36,29 @@ export const samplePrompts = [ export const rollTheDicePrompts = [ "(caribbean:1.5) (jazz:0.3)", "alarm clock", - "arabic (vocals:1.5)", + "bird calls", "baroque new wave pop", + "Berlin and Paris electronic fused together with acoustic tunes", "breathing", + "brazilian Forró dance", "british soul dance", "chainsaw funk", "church organ with a harpsichord", - "clarinet with maracas", "classic rock mellow gold progressive", "classical flute", + "cowbell ballad", + "funky human music", + "hip hop vocals piano cowbell", + "interdimensional cable", "jamaican ska rap", "laughing", + "lucky disco punk", "new orleans blues", "piano funk", "pop r&b urban contemporary", "reggae fusion", + "Shepard tone", + "smelly clown", "square dancing in wyoming", "tropical deep sea", "tropical electro house moombahton",