## Basic model info - Model name: bria/bria bria-expand - Model description: - Endpoint name: image ## Model schema The model schema is defined in the OpenAPI schema: [OpenAPI Schema](https://oapi.sunra.ai/main/bria/bria-expand/latest.json) ### Model input schema The model input schema is: ```json { "properties": { "prompt": { "default": "", "description": "Text on which you wish to base the image expansion. This parameter is optional. Bria currently supports prompts in English only, excluding special characters.", "title": "Prompt", "type": "string", "x-sr-order": 201 }, "aspect_ratio": { "anyOf": [ { "enum": [ "1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9" ], "type": "string" }, { "type": "null" } ], "description": "The desired aspect ratio of the final image. Will be used over original_image_size and original_image_location if provided.", "title": "Aspect Ratio", "x-sr-order": 303 }, "seed": { "anyOf": [ { "maximum": 2147483647, "minimum": 0, "type": "integer" }, { "type": "null" } ], "description": "You can choose whether you want your generated expension to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response. You can exclude this parameter if you are not interested in recreating your results. This parameter is optional.", "title": "Seed", "x-sr-order": 401 }, "negative_prompt": { "default": "", "description": "The negative prompt you would like to use to generate images.", "title": "Negative Prompt", "type": "string", "x-sr-order": 202 }, "canvas_size": { "description": "The desired size of the final image, after the expansion. should have an area of less than 5000x5000 pixels.", "examples": [ [ 1200, 674 ] ], "items": { "type": "integer" }, "title": "Canvas Size", "type": "array", "x-sr-order": 302 }, "image": { "anyOf": [ { "format": "uri", "maxLength": 2083, "minLength": 1, "type": "string" }, { "type": "string" } ], "description": "The URL of the input image.", "title": "Image", "x-sr-order": 301 }, "original_image_location": { "anyOf": [ { "items": { "type": "integer" }, "type": "array" }, { "type": "null" } ], "description": "The desired location of the original image, inside the full canvas. Provide the location of the upper left corner of the original image. The location can also be outside the canvas (the original image will be cropped). Will be ignored if aspect_ratio is provided.", "examples": [ [ 301, -66 ] ], "title": "Original Image Location", "x-sr-order": 305 }, "original_image_size": { "anyOf": [ { "items": { "type": "integer" }, "type": "array" }, { "type": "null" } ], "description": "The desired size of the original image, inside the full canvas. Ensure that the ratio of input image foreground or main subject to the canvas area is greater than 15% to achieve optimal results. Will be ignored if aspect_ratio is provided.", "examples": [ [ 610, 855 ] ], "title": "Original Image Size", "x-sr-order": 304 } }, "required": [ "image", "canvas_size" ], "title": "ImageExpandInput", "type": "object" } ``` ### Model output schema The model output schema is: ```json { "properties": { "image": { "properties": { "content_type": { "description": "The mime type of the file.", "title": "Content Type", "type": "string" }, "file_name": { "description": "The name of the file. It will be auto-generated if not provided.", "title": "File Name", "type": "string" }, "file_size": { "description": "The size of the file in bytes.", "title": "File Size", "type": "integer" }, "url": { "description": "The URL where the file can be downloaded from.", "title": "Url", "type": "string" } }, "required": [ "content_type", "file_name", "file_size", "url" ], "title": "SunraFile", "type": "object" } }, "required": [ "image" ], "title": "ImageOutput", "type": "object" } ``` ## Example inputs and outputs Use the following example inputs and outputs to understand the model. ### Input example ```json { "prompt": "", "aspect_ratio": null, "seed": null, "negative_prompt": "", "canvas_size": [ 1200, 674 ], "image": "", "original_image_location": [ 301, -66 ], "original_image_size": [ 610, 855 ] } ``` ### Output example ```json { } ``` ## Model code examples ### JavaScript ```javascript import { sunra } from "@sunra/client"; const result = await sunra.subscribe("bria/bria-expand/image", { input: { image: '', canvas_size: [ 1200, 674 ], aspect_ratio: null, original_image_size: [ 610, 855 ], original_image_location: [ 301, -66 ], prompt: '', seed: null, negative_prompt: '' }, logs: true, onQueueUpdate: (update) => { console.log(`Status Update: ${update.status}, Request ID: ${update.request_id}`); }, }); console.log(result.data); console.log(result.requestId); ``` ### Python ```python import sunra_client result = sunra_client.subscribe( "bria/bria-expand/image", arguments={ "image": "", "canvas_size": [1200, 674], "aspect_ratio": None, "original_image_size": [610, 855], "original_image_location": [301, -66], "prompt": "", "seed": None, "negative_prompt": "" }, with_logs=True, on_enqueue=print, on_queue_update=print, ) print(result) ``` ### Java ```java import ai.sunra.client.*; import java.util.Map; import com.google.gson.JsonObject; var client = SunraClient.withEnvCredentials(); var response = client.subscribe( "bria/bria-expand/image", SubscribeOptions.builder() .input(Map.of( "image", "", "canvas_size", 1200,674, "aspect_ratio", null, "original_image_size", 610,855, "original_image_location", 301,-66, "prompt", "", "seed", null, "negative_prompt", "")) .resultType(JsonObject.class) .onQueueUpdate(update -> System.out.printf( "\nStatus Update: %s, Request ID: %s%n", update.getStatus(), update.getRequestId() )) .logs(true) .build() ); System.out.println("Completed!"); System.out.println(response.getData()); ``` ### Kotlin ```kotlin import ai.sunra.client.kt.* import com.google.gson.JsonObject val client = createSunraClient() val response = client.subscribe( endpointId = "bria/bria-expand/image", input = mapOf( "image" to "", "canvas_size" to 1200,674, "aspect_ratio" to null, "original_image_size" to 610,855, "original_image_location" to 301,-66, "prompt" to "", "seed" to null, "negative_prompt" to ""), options = ai.sunra.client.kt.SubscribeOptions(logs = true), onUpdate = { update -> println("\nStatus Update: ${update.status}, Request ID: ${update.requestId}") } ) println("Completed!") println(response.data) ``` ### Curl ```bash curl --request POST \ --url https://api.sunra.ai/v1/queue/bria/bria-expand/image \ --header "Authorization: Key $SUNRA_KEY" \ --header "Content-Type: application/json" \ --data '{"image":"","canvas_size":[1200,674],"aspect_ratio":null,"original_image_size":[610,855],"original_image_location":[301,-66],"prompt":"","seed":null,"negative_prompt":""}' ``` ## Model readme >