using blueprint handler

This commit is contained in:
Seth Forsgren 2022-12-21 22:19:35 -08:00
parent f8361df805
commit 386b386840
1 changed files with 4 additions and 10 deletions

View File

@ -117,7 +117,7 @@ export default function ModelInference({
setNumRequestsMade((n) => n + 1); setNumRequestsMade((n) => n + 1);
// Customize for baseten // Customize for baseten
const apiHandler = useBaseten ? "/api/baseten" : "/api/server"; const apiHandler = useBaseten ? process.env.NEXT_PUBLIC_RIFFUSION_BASETEN_BLUEPRINT_URL : "/api/server";
const payload = useBaseten const payload = useBaseten
? { worklet_input: inferenceInput } ? { worklet_input: inferenceInput }
: inferenceInput; : inferenceInput;
@ -132,17 +132,11 @@ export default function ModelInference({
console.log(`Got result #${numResponsesReceived}`); console.log(`Got result #${numResponsesReceived}`);
if (useBaseten) { if (useBaseten) {
if (data?.worklet_output?.model_output) { console.log(data)
if (data?.output) {
newResultCallback( newResultCallback(
inferenceInput, inferenceInput,
JSON.parse(data.worklet_output.model_output) data.output
);
}
// Note, data is currently wrapped in a data field
else if (data?.data?.worklet_output?.model_output) {
newResultCallback(
inferenceInput,
JSON.parse(data.data.worklet_output.model_output)
); );
} else { } else {
console.error("Baseten call failed: ", data); console.error("Baseten call failed: ", data);