Skip to main content

Unofficial Library to interact with TryLeap REST API

Project description

TryLeap Python API

The py_leap_api Python package provides a simple interface for interacting with the TryLeap service, a cloud-based platform for generating images using artificial intelligence.

Installation

You can install the py_leap_api package using pip:

pip install py_leap_api

Getting Started

First, you'll need to create an account on the TryLeap website and obtain an API key.

Once you have an API key, you can use the TryLeap class to interact with the service. Here's a simple example that creates a model, uploads some images, and generates some images based on a prompt:

from py_leap_api.leap import TryLeap

# Create a TryLeap object with your API key
api_key = "your-api-key"
leap = TryLeap(api=api_key)

# Create a model
model = await leap.create_model("My Model")
print(model)

# add the model id
leap.set_model(model=model["id"])

# Upload some images
urls = [
    "https://example.com/image1.png",
    "https://example.com/image2.png",
    "https://example.com/image3.png",
]
await leap.upload_images_url(urls)

# Train the model
queue = await leap.training_model()
print(queue)

Ideally if you have a webhook url you can provide it to training_model in order to know when the training finished. Otherwise you can fetch the status that return from the function.

# Generate some images
prompt = "a cat sitting on a couch"
response = await leap.generate_image(prompt, number_images=3)

# Retrieve the output images
output_images = await leap.output_images()

License

This library is licensed under the MIT License. See the LICENSE file for details.

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

py_leap_api-0.0.6.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

py_leap_api-0.0.6-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file py_leap_api-0.0.6.tar.gz.

File metadata

  • Download URL: py_leap_api-0.0.6.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for py_leap_api-0.0.6.tar.gz
Algorithm Hash digest
SHA256 cfc392cb5abf2a794263b4ccd7fee6e00233b360798c97e4825f01c94c349542
MD5 5c1818162b2d08d67b1a54f642b50301
BLAKE2b-256 510d7dfaa93e621019b806e2771f018d83d627f5b4daddc94eb7a7b83349027c

See more details on using hashes here.

File details

Details for the file py_leap_api-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: py_leap_api-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for py_leap_api-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 0c806cf09ff10889cec589ec2167572cbac52d40650e005b58ca608f470d8964
MD5 944928c9f13788da18b61f96d663e8a7
BLAKE2b-256 afa066b23976ac42f5a7c924184d5aaf40b7bcaf9ad7330dfd213ff904b594e8

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