Skip to main content

Anything World API wrapper library and CLI

Project description

Anything World Python Client

Python library and CLI for Anything World API.

To use this package you'll need to obtain a valid Anything World API key. Please, create an account in our website and then visit your profile page to get access to your API key.

Before sending your 3D models to be animated, please make sure to follow our guidelines on preparing your 3D model for success.

To understand better the underlying web requests called by this Python package, please check our API documentation.

For more information of what changed between versions, please check the CHANGELOG file.

Installing

pip install anything-world

Using

First of all, create a new .env file with the right API key and URLs:

AW_API_KEY=<YOUR API KEY>
AW_API_URL=https://api.anything.world
AW_POLLING_URL=https://api.anything.world/user-processed-model

From Python

This library provides both synchronous and asynchronous implementations. The sync implementation is based on requests and tries to keep dependencies at minimum (i.e. no need to install asyncio nor aiohttp). However, if you use-case requires async calls, please follow the next section for its implementation.

Sync

from anything_world.sync_api import AWClient

# Create a client to be able to query Anything World's API
client = AWClient()

# Search for 3D models of `cats`:
response = client.find('cats')

# Upload files from ./examples/cat folder to be animated
response = client.animate(
    files_dir='./examples/cat',
    model_name='some_cat',
    model_type='cat',
    is_symmetric=True
)

# Response has the model_id of the 3D model that our AI pipeline is currently animating
model_id = response["model_id"]

# Runs a long-polling loop, starting it only after 10 seconds and after that,
# checking every 5 secs if the API is done animating the model
model_data = client.get_animated_model(
    model_id=model_id,
    waiting_time=5,
    warmup_time=10,
    verbose=True
)

# Check if our AI pipeline is done animating the model
is_finished = client.is_animation_done(model_id)
assert is_finished == True

# Gets all model data
model_data = client.get_model(model_id)

From CLI

All AWClient methods are exposed as commands of the anything CLI tool. Just call the anything tool and it will display a manual page of the available commands:

anything

You can do exactly the same we did in Python before through the CLI:

anything find "cat"
anything animate ./examples/cat "some cat" "cat" --is_symmetric
anything get_animated_model <MODEL_ID> --verbose
anything get_model <MODEL_ID>

To know more about the parameters of a specific command, just run the command with no arguments to get a help message:

anything find

For more information about a command, please run the command with the --help suffix:

anything find --help

Developing

Installing from source

git clone git@github.com:anythingworld/anything-world-python.git
cd anything-world-python
python3 -m venv venv
source venv/bin/activate
pip install -e .

Testing

pytest -v -s

Releasing a new pip package

First bump the version in pyproject.toml and then:

rm -rf dist/*
python3 -m build
python3 -m twine upload dist/*

License

This Python module has a MIT-style license, as found in the LICENSE file.

The cat model in examples/cat folder is from Google Poly (CC-BY 4.0) license.

The ASCII logo was generated by https://patorjk.com/software/taag/ using the original font fuzzy.flf by Juan Car (jc@juguete.quim.ucm.es).

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

anything_world-0.1.5.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

anything_world-0.1.5-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file anything_world-0.1.5.tar.gz.

File metadata

  • Download URL: anything_world-0.1.5.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for anything_world-0.1.5.tar.gz
Algorithm Hash digest
SHA256 d3505c261f67ec4d75f8de3c61327e23c5ab7b2536a451887077907332f347f4
MD5 299aab7180e87a9722b10300098a773a
BLAKE2b-256 ced0ad433a59cd5c0bfe25c654b6074039fcc8a9ca97075c8945e572b5e67d08

See more details on using hashes here.

File details

Details for the file anything_world-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for anything_world-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1e3322119f17d38dd6b600f3494a9503d498864f1e0a1ce5f934142fee6f8e87
MD5 f24f1a3ec2ac02d8e1461af9df8ca8fd
BLAKE2b-256 53edff2d1b5691336a8918443b5b1be2baff8dbea232b2603530dbbe3b9fae05

See more details on using hashes here.

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