Skip to main content

No project description provided

Project description

Styley Python SDK

📚 Table of Contents

  1. Introduction
  2. Install Python
  3. Verify Installation
  4. Install SDK
  5. Environment Variables
  6. Usage
  7. Class & Method Reference

Introduction

The Styley Python SDK provides a simple and intuitive interface to interact with Styley's deployment and model services. With this SDK, you can easily create and manage deployments, query models, and retrieve job statuses programmatically.


Install Python

Install Using Official Installer (Recommended)

  1. Download Python

    • Visit Python official download page.
    • Download the installer for your operating system:
      • Windows: Download the .exe file.
      • MacOS: Download the .pkg file.
      • Linux: Use the system's package manager (e.g., apt, yum).
  2. Run the installer

    • Check Add Python to PATH (important).
    • Select Install Now.
  3. Restart your terminal after the installation.


Verify Installation

Ensure Python and pip are installed correctly.

python --version
pip --version

Expected output:

Python 3.10.0  # Example version
pip 23.1.2     # Example pip version

If you see "command not found", double-check if Python is installed and in your PATH.


Install SDK

Install the Python SDK via pip:

pip install styleysdk

This installs the Styley SDK and its dependencies.


Environment Variables

To authenticate API requests, set the following environment variable:

export X_STYLEY_KEY=***************************

Usage

This section covers available methods for interacting with deployments and models.


Deployments

📤 Create Deployment

The Create Deployment method allows you to create a new deployment using a model name and arguments. It returns an output with a job_id that you can use to fetch the final results.

from styleysdk import Styley
from styleysdk.deployments.model import CreateDeployment
from styleysdk.deployments.model import Job

styley = Styley()
deployment = styley.deployments.create(
    deployment=CreateDeployment(
        name="Virtual Staging Fast",
        model="fc5525a1-d073-4ee2-95f7-a6b9388aab94",
        args={              
            "image": "https://cdn.mediamagic.dev/media/c2310708-5b9d-11ef-b10b-30d042e69440.jpg",
            "remove_existing_furniture": "off",
            "room_type": "living",
            "style": "modern",
            "wait_for_completion": "false"
        }
    )
)
print("Deployment created successfully")
print(deployment)

Additional Parameters:

  • output_format (str, optional): Output format for the result.

    • Images: png, jpg, jpeg, gif, bmp, tiff, webp, ico
    • Videos: mp4, webm, mkv, mov, avi
  • output_width (int, optional): Output image width in pixels (positive integer)

  • output_height (int, optional): Output image height in pixels (positive integer)

Note: For image resizing, both width and height must be specified together. If only one dimension is provided, the original image size will be maintained.

Example:

from styleysdk import Styley
from styleysdk.deployments.model import CreateDeployment
from styleysdk.deployments.model import Job

styley = Styley()
deployment = styley.deployments.create(
    deployment=CreateDeployment(
        name="Virtual Staging Fast",
        model="fc5525a1-d073-4ee2-95f7-a6b9388aab94",
        args={              
            "image": "https://cdn.mediamagic.dev/media/c2310708-5b9d-11ef-b10b-30d042e69440.jpg",
            "remove_existing_furniture": "off",
            "room_type": "living",
            "style": "modern",
            "wait_for_completion": "false"
        },
        output_format="png",
        output_width=1024,
        output_height=1024,
    )
)
print("Deployment created successfully")
print(deployment)

📄 Get Deployment By ID

Fetch details of a specific deployment using its deployment ID.

Example:

from styleysdk import Styley
from styleysdk.deployments.model import CreateDeployment
from styleysdk.deployments.model import Job

styley = Styley()
deployment_details = styley.deployments.get_by_id(deployment_id)
print(deployment_details)

📜 List Deployments

Retrieve a list of all deployments.

Example:

from styleysdk import Styley
from styleysdk.deployments.model import CreateDeployment
from styleysdk.deployments.model import Job

styley = Styley()
deployments_list = styley.deployments.list()
print(deployments_list)

🚀 Get Deployment Job

Get the status of a deployment job using its job ID.

Example:

from styleysdk import Styley
from styleysdk.deployments.model import CreateDeployment
from styleysdk.deployments.model import Job

styley = Styley()
job_status = styley.deployments.get_job(job_id)
print(job_status)

Models

📜 List Models

Retrieve a list of all models available for deployments.

Example:

from styleysdk import Styley
from styleysdk.deployments.model import CreateDeployment
from styleysdk.deployments.model import Job

styley = Styley()
models_list = styley.models.list()
print(models_list)

🔍 Get Model By ID

Fetch a specific model’s details using its model ID.

Example:

from styleysdk import Styley
from styleysdk.deployments.model import CreateDeployment
from styleysdk.deployments.model import Job

styley = Styley()
model_details = styley.models.get_by_id(model_id)
print(model_details)

🔍 Get Model By Name

Fetch a specific model’s details using its model name.

Example:

from styleysdk import Styley
from styleysdk.deployments.model import CreateDeployment
from styleysdk.deployments.model import Job

styley = Styley()
model_details = styley.models.get_by_name(model_name)
print(model_details)

Class & Method Reference

Class Method Description
Deployments create(payload) Create a new deployment.
Deployments get_by_id(id) Get deployment details by deployment ID.
Deployments list() List all deployments.
Deployments get_job(job_id) Get the status of a deployment job.
Models list() List all available models.
Models get_by_id(id) Get model details by model ID.
Models get_by_name(name) Get model details by model name.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

styleysdk-0.1.2.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

styleysdk-0.1.2-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file styleysdk-0.1.2.tar.gz.

File metadata

  • Download URL: styleysdk-0.1.2.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.3 Windows/11

File hashes

Hashes for styleysdk-0.1.2.tar.gz
Algorithm Hash digest
SHA256 cd969e9728d31f4f7056fce1611de3434336c08d82e2ac6c55c2e65d12ea12e9
MD5 11e679c52b964bdb844e9180feda3280
BLAKE2b-256 ee86d975be7c596657b0e61e196abd51ea36f84d69160aec7808277c4f43ebe3

See more details on using hashes here.

File details

Details for the file styleysdk-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: styleysdk-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.3 Windows/11

File hashes

Hashes for styleysdk-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 04f582bf6df4369762d8fbb73ae43d9c2b412525b30fdcb6019df19da2f503a4
MD5 de0399a24e2499ec5ae2ce781065cfb3
BLAKE2b-256 c3a37508919e39dd4c3ff9fa638f07878a4e7c8a5bc4e23fdb77b0f8cbeded68

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page