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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

Supported by

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