pipelines-beta / hello-replicate

Give the model an image and it will attempt to generate a copy using Claude and Flux dev

  • Public
  • 12 runs
  • CPU
  • GitHub
Iterate in playground

Input

image
*file

Input image to test

Output

output
Generated in
Steps
IDModelStatus
w0thjyvpz1rma0cq3dgvz2pr00black-forest-labs/flux-dev
Succeeded
3nf7mv1psdrmc0cq3dgaw6g4pcanthropic/claude-4-sonnet
Succeeded

Run time and cost

This model runs on CPU hardware. We don't yet have enough runs of this model to provide performance information.

Readme

“Telephone” for images. Pass an image as the image parameter and the model will ask Claude to describe the image and Flux dev to generate a copy.

def run(
    image: Path = Input(description="Input image to test"),
) -> Path:
    replicate = Client()
    claude_prompt = """
You have been asked to generate a prompt for an image model that should re-create the
image provided to you exactly. Please describe the provided image in great detail
paying close attention to the contents, layout and style.
    """
    prompt = replicate.run(
        "anthropic/claude-4-sonnet", input={"prompt": claude_prompt, "image": image}
    )
    output = replicate.run(
        "black-forest-labs/flux-dev", input={"prompt": "".join(prompt)}
    )

    with tempfile.TemporaryDirectory(delete=False) as tmpdir:
        dest_path = os.path.join(tmpdir, "output.webp")
        with open(dest_path, "wb") as file:
            file.write(output[0].read())
        return Path(dest_path)