Inference Providers documentation
Replicate
Replicate
Replicate is building tools so all software engineers can use AI as if it were normal software. You should be able to import an image generator the same way you import an npm package. You should be able to customize a model as easily as you can fork something on GitHub.
Supported tasks
Text To Image
Find out more about Text To Image here.
Copied
from huggingface_hub import InferenceClient
client = InferenceClient(
provider="replicate",
api_key="hf_xxxxxxxxxxxxxxxxxxxxxxxx",
)
# output is a PIL.Image object
image = client.text_to_image(
"Astronaut riding a horse",
model="black-forest-labs/FLUX.1-dev",
)
Text To Video
Find out more about Text To Video here.
Copied
from huggingface_hub import InferenceClient
client = InferenceClient(
provider="replicate",
api_key="hf_xxxxxxxxxxxxxxxxxxxxxxxx",
)
video = client.text_to_video(
"A young man walking on the street",
model="Wan-AI/Wan2.1-T2V-14B",
)