wty-ustc / hairclip

Design Your Hair by Text and Reference Image

  • Public
  • 286K runs
  • T4
  • GitHub
  • Paper
  • License

Run wty-ustc/hairclip 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
Learn more about setup

Run wty-ustc/hairclip using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.

import Replicate from "replicate";
const replicate = new Replicate();

const input = {
    image: "https://replicate.delivery/mgxm/b8be17a7-abcb-4421-80f2-e6a1e3fe38c7/MarkZuckerberg.jpg",
    editing_type: "both",
    color_description: "blond",
    hairstyle_description: "hi-top fade hairstyle"
};

const output = await replicate.run("wty-ustc/hairclip:b95cb2a16763bea87ed7ed851d5a3ab2f4655e94bcfb871edba029d4814fa587", { input });

import { writeFile } from "node:fs/promises";
await writeFile("output.png", output);
//=> output.png written to disk
Learn more