Bring your own code and run CPU, GPU, and data-intensive compute at scale. The serverless platform for AI teams — scale to thousands of GPUs, and back to zero.
import modal app = modal.App("flux-inference") image = (modal.Image.debian_slim() .pip_install("torch", "diffusers")) @app.function(gpu="A100", image=image) def generate(prompt: str): # cold-starts a GPU container on demand return pipe(prompt).images[0] @app.local_entrypoint() def main(): prompts = load_prompts() # 24 prompts # fan out across many GPUs, autoscaling for img in generate.map(prompts): img.save()