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.

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_id="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.3.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.3-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: styleysdk-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 2c83b61382942cd977f4482e1990ef607c51ff112e019338687685a5d252e94b
MD5 3782045312c3a99725ed05f4d2d6a6d7
BLAKE2b-256 7575cb9f432a36a971daf51cd1cc276c5d86cf5549a3bc326704d2386fca3d46

See more details on using hashes here.

File details

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

File metadata

  • Download URL: styleysdk-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 8.1 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7fe2fe3f3ff52a761e0d7ad99d8f354147a1229f256f942c3dd74752cdaadf3e
MD5 cb92edaa7092dd054770cf783e926d51
BLAKE2b-256 1fafa89bc36940e9d9182b25e5219d675193e4f8556137fb4f028d98d2053290

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