DeepAI
Log In Sign Up

Neural Style API

url upload file upload url upload file upload

Transfers the style from one image onto the content of another image.



API Docs
QUICK START API REQUEST
curl \
    -F 'style=YOUR_IMAGE_URL' \
    -F 'content=YOUR_IMAGE_URL' \
    -H 'api-key:YOUR_API_KEY' \
    https://api.deepai.org/api/neural-style 

Neural Style API Documentation

Pricing: $5 per 100 API calls

Neural Style cURL Examples

# Example posting a image URL:

curl \
    -F 'style=YOUR_IMAGE_URL' \
    -F 'content=YOUR_IMAGE_URL' \
    -H 'api-key:YOUR_API_KEY' \
    https://api.deepai.org/api/neural-style 


# Example posting a local image file:

curl \
    -F 'style=@/path/to/your/file.jpg' \
    -F 'content=@/path/to/your/file.jpg' \
    -H 'api-key:YOUR_API_KEY' \
    https://api.deepai.org/api/neural-style 

Neural Style Javascript Examples

// Get the 'deepai' package here (Compatible with browser & nodejs):
//     https://www.npmjs.com/package/deepai
// All examples use JS async-await syntax, be sure to call the API inside an async function.
//     Learn more about async-await here: https://javascript.info/async-await

// Example posting a image URL:

const deepai = require('deepai'); // OR include deepai.min.js as a script tag in your HTML

deepai.setApiKey('YOUR_API_KEY');

(async function() {
    var resp = await deepai.callStandardApi("neural-style", {
            style: "YOUR_IMAGE_URL",
            content: "YOUR_IMAGE_URL",
    });
    console.log(resp);
})()


// Example posting file picker input image (Browser only):

const deepai = require('deepai'); // OR include deepai.min.js as a script tag in your HTML

deepai.setApiKey('YOUR_API_KEY');

(async function() {
    var resp = await deepai.callStandardApi("neural-style", {
            style: document.getElementById('yourFileInputId'),
            content: document.getElementById('yourFileInputId'),
    });
    console.log(resp);
})()


// Example posting a local image file (Node.js only):
const fs = require('fs');

const deepai = require('deepai'); // OR include deepai.min.js as a script tag in your HTML

deepai.setApiKey('YOUR_API_KEY');

(async function() {
    var resp = await deepai.callStandardApi("neural-style", {
            style: fs.createReadStream("/path/to/your/file.jpg"),
            content: fs.createReadStream("/path/to/your/file.jpg"),
    });
    console.log(resp);
})()

Neural Style Python Examples

# Example posting a image URL:

import requests
r = requests.post(
    "https://api.deepai.org/api/neural-style",
    data={
        'style': 'YOUR_IMAGE_URL',
        'content': 'YOUR_IMAGE_URL',
    },
    headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())


# Example posting a local image file:

import requests
r = requests.post(
    "https://api.deepai.org/api/neural-style",
    files={
        'style': open('/path/to/your/file.jpg', 'rb'),
        'content': open('/path/to/your/file.jpg', 'rb'),
    },
    headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())

Neural Style Ruby Examples

# Example posting a image URL:

require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/neural-style', timeout: 600,
    headers: {'api-key' => 'YOUR_API_KEY'},
    payload: {
        'style' => 'YOUR_IMAGE_URL',
        'content' => 'YOUR_IMAGE_URL',
    }
)
puts r


# Example posting a local image file:

require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/neural-style', timeout: 600,
    headers: {'api-key' => 'YOUR_API_KEY'},
    payload: {
        'style' => File.new('/path/to/your/file.jpg'),
        'content' => File.new('/path/to/your/file.jpg'),
    }
)
puts r

Neural Style Csharp Examples

// Ensure your DeepAI.Client NuGet package is up to date: https://www.nuget.org/packages/DeepAI.Client
// Example posting a image URL:

using DeepAI; // Add this line to the top of your file

DeepAI_API api = new DeepAI_API(apiKey: "YOUR_API_KEY");

StandardApiResponse resp = api.callStandardApi("neural-style", new {
        style = "YOUR_IMAGE_URL",
        content = "YOUR_IMAGE_URL",
});
Console.Write(api.objectAsJsonString(resp));


// Example posting a local image file:

using DeepAI; // Add this line to the top of your file

DeepAI_API api = new DeepAI_API(apiKey: "YOUR_API_KEY");

StandardApiResponse resp = api.callStandardApi("neural-style", new {
        style = File.OpenRead("C:\\path\\to\\your\\file.jpg"),
        content = File.OpenRead("C:\\path\\to\\your\\file.jpg"),
});
Console.Write(api.objectAsJsonString(resp));