const imageKey = encodeURIComponent(new URL(prediction.input.image_url).pathname);
const inputKey = encodeURIComponent(prediction.input.labels.toString());
const cacheKey = `${replicateURL}-${imageKey}-${inputKey}`;
console.log({ replicateURL, imageKey, inputKey });
console.log('cacheKey put', cacheKey);
const cacheResponse = new Response(prediction.output, {
headers: {
'Cache-Control': 'private, max-age=31536000',
'Content-Type': 'text/plain',
},
});
await caches.default.put(cacheKey, cacheResponse);
const imageKey = encodeURIComponent(new URL(prediction.input.image_url).pathname);
const inputKey = encodeURIComponent(prediction.input.labels.toString());
const cacheKey = `${replicateURL}-${imageKey}-${inputKey}`;
console.log({ replicateURL, imageKey, inputKey });
console.log('cacheKey put', cacheKey);
const cacheResponse = new Response(prediction.output, {
headers: {
'Cache-Control': 'private, max-age=31536000',
'Content-Type': 'text/plain',
},
});
await caches.default.put(cacheKey, cacheResponse);