推理提供商文档

Replicate

Hugging Face's logo
加入 Hugging Face 社区

并获得增强的文档体验

开始使用

Replicate

所有支持的Replicate模型都可以在此处找到

Replicate正在构建工具,以便所有软件工程师都可以像使用普通软件一样使用AI。您应该能够像导入npm包一样导入图像生成器。您应该能够像在GitHub上分叉一样轻松地自定义模型。

支持的任务

图像到图像

了解更多关于图像到图像的信息,请点击此处

import os
from huggingface_hub import InferenceClient

client = InferenceClient(
    provider="replicate",
    api_key=os.environ["HF_TOKEN"],
)

with open("cat.png", "rb") as image_file:
   input_image = image_file.read()

# output is a PIL.Image object
image = client.image_to_image(
    input_image,
    prompt="Turn the cat into a tiger.",
    model="black-forest-labs/FLUX.1-Kontext-dev",
)

文本到图像

了解更多关于文本到图像的信息,请点击这里

import os
from huggingface_hub import InferenceClient

client = InferenceClient(
    provider="replicate",
    api_key=os.environ["HF_TOKEN"],
)

# output is a PIL.Image object
image = client.text_to_image(
    "Astronaut riding a horse",
    model="Qwen/Qwen-Image",
)

文本到视频

了解更多关于文本到视频的信息,请点击此处

import os
from huggingface_hub import InferenceClient

client = InferenceClient(
    provider="replicate",
    api_key=os.environ["HF_TOKEN"],
)

video = client.text_to_video(
    "A young man walking on the street",
    model="Wan-AI/Wan2.2-TI2V-5B",
)
< > 在 GitHub 上更新