Text-to-image-style
1 Create Style

Introduction

Create style from text-to-image.

Create Style

Request

POST /tti-styles

Parameters

zip_url REQUIRED
type : string
in : body
description : URL of the training image zip URL


description REQUIRED
type : string
in : body
description : Description of the style


is_public OPTIONAL
type : boolean
in : body
description : Is the style publically available or not.

Code Snippets

Python

import requests
import json

url = "https://api.csm.ai:5566/tti-styles"

payload = json.dumps({
  "zip_url": "https://xyz.com/upload/pixer_head.zip",
  "description": "Pixar Heads"
})
headers = {
  'x-api-key': '<X-API_KEY>',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Node.js

var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://api.csm.ai:5566/tti-styles',
  'headers': {
    'x-api-key': '<X-API_KEY>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "zip_url": "https://xyz.com/upload/pixer_head.zip",
    "description": "Pixar Heads"
  })

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Curl


curl -k --location 'https://api.csm.ai:5566/tti-styles' \
--header 'x-api-key: <X-API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
    "zip_url": "https://xyz.com/upload/pixer_head.zip",
    "description": "Pixar Heads"
}'

Response

{
    "error": "",
    "message": "Created",
    "statusCode": 201,
    "data": {
        "_id": "657aa82972bbc64db256e94e",
        "description": "Pixar Heads",
        "user_id": "62fdb597f3efdd2e0a094fdc",
        "style_id": "a9dee804-f0df-4d1c-abcc-f29d598183fd",
        "image_url": "https://xyz.com/upload/data/lora_previews/a9dee804-f0df-4d1c-abcc-f29d598183fd_thumbnail.jpg",
        "zip_url": "https://xyz.com/upload/pixer_head.zip",
        "is_public": false,
        "status": "training",
        "is_deleted": false,
        "created_at": "2023-12-14T07:00:57.695Z",
        "updated_at": "2023-12-14T07:01:09.937Z"
    }
}