The prediction API endpoints enable users to start and manage image processing sessions, such as editing, generating, and enhancing images using AI models. Users can monitor the progress of each session and retrieve the generated images or other results.
Image Generation Process
The image generation API lets users create one or more images from a text prompt. This process is asynchronous, and when a request is initiated, the response contains two important properties:
-
id (uuid): Identifier of the prediction session, which can be used to query the session API to get updates on the session's progress.
-
state (string): Represents the progress of the session. Initially set to
scheduled
, it transitions through the following states:state description scheduled The default state, indicating that the prediction is queued and ready for processing. running The session is actively being processed by the model. succeed The prediction has completed successfully. failed An error occurred during the image generation, and no results are available.
Example Response snippet
{
"id": "d61fdfd1-985e-43e9-8e7a-d776f7fb7819",
"state": "scheduled"
}
In this example, the response shows that the prediction session has been created with the initial state set to scheduled
.
To receive updates and retrieve generated images, make a request to /predict/session/{id}
.
Prediction Session Results
The Prediction API response can includes both the original image uploaded by the user and the images generated as a result of the AI processing. The type
property in each image object indicates whether the image is an "input"
or a "result"
:
type | description |
---|---|
input | This is the original image provided by the user. |
result | These are the images generated by Seelab's AI during the processing session. |
Example Response snippet
{
"result": {
"image": [
{
"id": 1000,
"type": "input",
"url": "https://app.seelab.ai/assets/original/predict/images/example-image-id"
},
{
"id": 1001,
"type": "result",
"url": "https://app.seelab.ai/assets/original/predict/images/example-image-id"
}
]
}
}
In this example, the first image is the user's input, while the second image is a generated result.
Rate Limits
The prediction API is subject to rate limits based on the user's subscription plan. The following table shows the number of prediction requests allowed within a 10-second window for each plan:
Plan | Predictions | Window |
---|---|---|
Free | 1 | 10 secs |
Rookie | 2 | 10 secs |
Premium | 3 | 10 secs |
Pro | 5 | 10 secs |