Blog

Idea Inspired by Wizart Vision API: The Ultimate Fun Design Tool

Technology
Pavel Batashov
4min

Here at Wizart, we are constantly showcasing the vast potential of our Vision API technology in revolutionizing e-commerce sales. During our exploration, we have disclosed a wide range of use cases of our API, including visualizing various products such as curtains, roman shades, doors, and much more.

And today, we would like to highlight another exciting capability of Vision API - the "on the fly" rendering. This feature allows end-users to easily upload photos from the UI without having to rely on per-uploaded data from the Product Information Management (PIM) system. With the "on the fly" rendering, our API can instantly create a rendered image of the uploaded product photo, opening up new possibilities and opportunities for our users to explore.

Imagine being able to take a photo of your room and add different murals or experiment with flooring options in real time. Or for example, users can collaborate with friends and family on a design project and see the changes being made in real-time. The possibilities are endless.

With The Ultimate Fun Design Tool (let’s call it loud), users can experiment with their own designs and share their creations with others. Whether you're planning a home renovation or just want to have fun with different design ideas, this app provides a creative and interactive way to do so.

To illustrate the ease of implementation of such a feature, we would like to provide an example of an iOS app that uses Swift to call Wizart API methods.

To start developing an iOS app that uses the Wizart Vision API, you'll need to create a new Xcode project and import the necessary dependencies. Here's an example of how to make a call to the API methods using Swift code:

1. Import Alamofire and SwiftyJSON dependencies in your Xcode project:

import Alamofire 
import SwiftyJSON

 

2. Create a function that will upload the custom interior image to the Wizart API:

func uploadCustomInterior(image: UIImage, completion: @escaping (String?, Error?) -> Void) {
    let url = "https://rni.wizart.tech/api/rooms"
    let headers: HTTPHeaders = [
        "Accept": "application/json",
        "Device-Token": UUID().uuidString,
        "Authorization": "{{ API_KEY }}"
    ]
    AF.upload(multipartFormData: { multipartFormData in
        if let imageData = image.jpegData(compressionQuality: 0.5) {
            multipartFormData.append(imageData, withName: "image", fileName: "interior.jpg", mimeType: "image/jpeg")
        }
    }, to: url, headers: headers).responseJSON { response in
        switch response.result {
        case .success(let value):
            let json = JSON(value)
            let uuid = json["uuid"].stringValue
            completion(uuid, nil)
        case .failure(let error):
            completion(nil, error)
        }
    }
}

3. Create a function that will apply an image as a mural from the user's catalog to the interior:

func applyProductToInterior(productImage: UIImage, roomUUID: String, completion: @escaping (String?, Error?) -> Void) {
    let url = "https://rni.wizart.ai/apply/custom?hash={{ HASH }}"
    let headers: HTTPHeaders = [
        "Device-Token": UUID().uuidString,
        "Authorization": "{{ API_KEY }}",
        "Content-Type": "application/json"
    ]
    let parameters: [String: Any] = [
        "data": [
            "type": "products",
            "attributes": [
                "type": "wall_mural",
                "name": "Murals 02",
                "vendor_code": "Murals 02",
                "image_path": "",
                "preview_path": "",
                "link": "",
                "width": "2",
                "height": "3",
                "unit": "m",
                "repeatable": 1,
                "surface": ["wall"],
                "height_feet": 0,
                "height_inch": 0,
                "width_feet": 0,
                "width_inch": 0
            ],
            "relationships": [
                "selected_surfaces": [
                    "data": [
                        ["type": "walls", "id": 0]
                    ]
                ],
                "rooms": [
                    "data": [
                        "type": "rooms",
                        "id": roomUUID
                    ]
                ],
                "share": nil
            ]
        ],
        "included": []
    ]
    let hash = MD5(string: "(parameters)")
    let finalURL = url.replacingOccurrences(of: "{{ HASH }}", with: hash)
    AF.request(finalURL, method: .post, parameters: parameters, encoding: JSONEncoding.default, headers: headers).responseJSON { response in
        switch response.result {
        case .success(let value):
            let json = JSON(value)
            let success = json["success"].stringValue
            completion(success, nil)
        case .failure(let error):
            completion(nil, error)
        }
    }
}

 

And here is what the result may look like:

Please note that to use these capabilities, you need to request a trial API token by signing up for a free trial.

With these code snippets above, developers can integrate the Vision API methods into their app and start using its features right away. The solution provides you with complete flexibility in UI design, so you can build an app as you see fit.

In summary, The Ultimate Fun Design Tool can be the perfect app for anyone who wants to have fun with interior design and collaborate with others. With its diverse range of features, users can experiment with different design ideas, share their creations with friends and family, and make informed decisions about their home renovation projects.

Furthermore, developers don't need to worry about the technical aspects of implementing complex features within the app. Thanks to Wizart Vision API, they can easily integrate advanced features in minutes.