Skip to content

replicate/cloudflare-image-cache

Repository files navigation

Cloudflare Image Cache

This repo contains a CloudFlare worker called "placeholder-zoo". The worker runs image generation models on Replicate, stores the output files in CloudFlare, and serves them with dynamic image resizing using Cloudflare Transformations.

👉 Follow the guide at https://replicate.com/docs/guides/cloudflare-image-cache


image

Prerequisites

Usage

Read the guide for step-by-step instructions to create this app, or jump right into using it with the commands below.

First, clone this repo:

git clone https://github.com/replicate/cloudflare-image-cache
cd cloudflare-image-cache

Then, install dependencies:

npm install

Then, set up secrets for your worker. You'll need these secrets:

  • REPLICATE_API_TOKEN
  • CLOUDFLARE_ACCOUNT_ID
  • CLOUDFLARE_API_TOKEN
  • CLOUDFLARE_IMAGE_ACCOUNT_HASH

Then run your worker locally:

npm run dev

About

Use Cloudflare and Replicate to generate, cache, and serve images

Resources

Stars

Watchers

Forks