fofr/flux-handwriting-and-sketch
Run fofr/flux-handwriting-and-sketch with an API
Use one of our client libraries to get started quickly.
Set the REPLICATE_API_TOKEN
environment variable
export REPLICATE_API_TOKEN=<paste-your-token-here>
Learn more about authentication
Install Replicate’s Node.js client library
npm install replicate
Run fofr/flux-handwriting-and-sketch using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
import { writeFile } from "fs/promises";
import Replicate from "replicate";
const replicate = new Replicate();
const input = {
prompt: "a HWRIT sketch"
};
const output = await replicate.run("fofr/flux-handwriting-and-sketch:d592f6972aadf30aadf04272cabb1698eb80feb669cbc356e8a3610d4fb2fb39", { input });
// To access the file URLs:
console.log(output[0].url());
//=> "https://replicate.delivery/.../output_0.webp"
// To write the files to disk:
for (const [index, item] of Object.entries(output)) {
await writeFile(`output_${index}.webp`, item);
}
//=> output_0.webp written to disk