Package: anything-world
Anything World Python ClientPython 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 inour websiteand then visityour profile pageto
get access to your API key.Before sending your 3D models to be animated, please make sure to followour guidelineson preparing your 3D model for success.To understand better the underlying web requests called by this
Python package, please check ourAPI documentation.For more information of what changed between versions, please check theCHANGELOGfile.Installingpipinstallanything-worldUsingFirst of all, create a new.envfile with the right API key and URLs:AW_API_KEY=<YOURAPIKEY>AW_API_URL=https://api.anything.worldAW_POLLING_URL=https://api.anything.world/user-processed-modelFrom PythonThis library provides both synchronous and asynchronous implementations.
The sync implementation is based onrequestsand tries to keep dependencies
at minimum (i.e. no need to installasyncionoraiohttp). However,
if you use-case requires async calls, please follow the next section for its
implementation.Syncfromanything_world.sync_apiimportAWClient# Create a client to be able to query Anything World's APIclient=AWClient()# Search for 3D models of `cats`:response=client.find('cats')# Upload files from ./examples/cat folder to be animatedresponse=client.animate('./examples/cat','some_cat','cat',is_symmetric=True)# Response has the model_id of the 3D model that our AI pipeline is currently animatingmodel_id=response["model_id"]# Runs a long-polling loop, starting it only after 2 minutes and after that,# checking every 5 secs if the API is done animating the modelmodel_data=client.get_animated_model(model_id,waiting_time=5,warmup_time=120)# Check if our AI pipeline is done animating the modelis_finished=client.is_animation_done(model_id)assertis_finished==True# Gets all model datamodel_data=client.get_model(model_id)Asyncimportasynciofromanything_world.async_apiimportAWClient# Create a client to be able to query Anything World's APIclient=AWClient()# Search for 3D models of `cats`:response=asyncio.run(client.find('cats'))# Upload files from ./examples/cat folder to be animatedresponse=asyncio.run(client.animate('./examples/cat','some_cat','cat',is_symmetric=True))# Response has the model_id of the 3D model that our AI pipeline is currently animatingmodel_id=response["model_id"]# Runs a long-polling loop, starting it only after 2 minutes and after that,# checking every 5 secs if the API is done animating the model.model_data=asyncio.run(client.get_animated_model(model_id,waiting_time=5,warmup_time=120))# Check if our AI pipeline is done animating the modelis_finished=asyncio.run(client.is_animation_done(model_id))assertis_finished==True# Gets all model datamodel_data=async.run(client.get_model(model_id))From CLIAllAWClientmethods are exposed as commands of theanythingCLI tool.
Just call theanythingtool and it will display a manual page of the
available commands:anythingYou can do exactly the same we did in Python before through the CLI:anythingfind"cat"anythinganimate./examples/cat"some cat""cat"--is_symmetric
anythingget_animated_model<MODEL_ID>--verbose
anythingget_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:anythingfindFor more information about a command, please run the command with the--helpsuffix:anythingfind--helpDevelopingInstalling from sourcegitclonegit@github.com:anythingworld/anything-world-python.gitcdanything-world-python
python3-mvenvvenvsourcevenv/bin/activate
pipinstall-e.Testingpytest-v-sReleasing a new pip packageFirst bump the version inpyproject.tomland then:rm-rfdist/*
python3-mbuild
python3-mtwineuploaddist/*LicenseThis Python module has a MIT-style license, as found in the LICENSE file.The cat model inexamples/catfolder is from Google Poly (CC-BY 4.0) license.The ASCII logo was generated byhttps://patorjk.com/software/taag/using the
original font fuzzy.flf by Juan Car (jc@juguete.quim.ucm.es).