Playground v2.5 1024
ServerlessImageImg2Img
ServerlessImageImg2Img
Playground v2.5 is a diffusion-based text-to-image generative model, and a successor to Playground v2.
Playground v2.5 1024 is available via Fireworks' serverless image API, where you pay per image step (per generated image) and do not need to configure GPUs.
The Fireworks image generation API can be called by making HTTP requests from any language. We also provide a Python client library that you can use to easily call the API.
Generate an image response for the given prompt.
# pip install 'fireworks-ai' import fireworks.client from fireworks.client.image import ImageInference, Answer # Initialize the ImageInference client fireworks.client.api_key = "$API_KEY" inference_client = ImageInference(model="playground-v2-5-1024px-aesthetic") # Generate an image using the text_to_image method answer : Answer = inference_client.text_to_image( prompt="", cfg_scale=3, height=1024, width=1024, sampler=None, steps=30, seed=1, safety_check=False, output_image_format="JPG", # Add additional parameters here ) if answer.image is None: raise RuntimeError(f"No return image, {answer.finish_reason}") else: answer.image.save("output.jpg")
The Fireworks image generation API can be called by making HTTP requests from any language. We also provide a Python client library that you can use to easily call the API.
Instructions for deploying on-demand deployments for these models can be found on the model HuggingFace pages.
Below we describe the raw REST API for making requests to the API. For easy generation of calls, see the console above.
All API calls require a valid authentication token. You can obtain a token from the Fireworks console. When calling the API, make sure to specify the Authentication header, with your token after the word Bearer. For example: Authorization: Bearer abcd1234defg5678hijk9012lmno3456pqrs7890tuvw1234.
Since image_to_image and control_net require uploading binary image files, the APIs are designed around the multipart/form-data content type. This means that forming your query is not as simple as writing a JSON response body, as with text-to-image. See information about how to make these requests in Python requests, node.js fetch, and cURL.
Generate an image from a text prompt
POST https://api.fireworks.ai/inference/v1/image_generation/accounts/fireworks/models/playground-v2-5-1024px-aesthetic HTTP/1.1