### Install zylora with pip Source: https://github.com/zylora-dev/zylora-python/blob/main/README.md Install the zylora package from PyPI using pip. ```bash pip install zylora ``` -------------------------------- ### Define a GPU function with @zylora.fn Source: https://github.com/zylora-dev/zylora-python/blob/main/README.md Decorator example that defines a GPU function using an H100 GPU. The function loads a Hugging Face model and returns embeddings. ```python import zylora @zylora.fn(gpu="H100") def embed(text: str) -> list[float]: from transformers import AutoModel model = AutoModel.from_pretrained("BAAI/bge-large-en-v1.5") return model.encode(text).tolist() ``` -------------------------------- ### Login via CLI Source: https://github.com/zylora-dev/zylora-python/blob/main/README.md Authenticate using the Zylora CLI login command. ```bash zy login ``` -------------------------------- ### Deploy with zy deploy Source: https://github.com/zylora-dev/zylora-python/blob/main/README.md Deploys the defined GPU function using the Zylora CLI. ```bash zy deploy ``` -------------------------------- ### Invoke functions locally, remotely, batch, streaming, and async Source: https://github.com/zylora-dev/zylora-python/blob/main/README.md Shows the different invocation modes: local call, remote call, batch map, streaming for LLMs, and async with job result. ```python # Local (development) result = embed("hello world") # Remote (deployed) result = embed.remote("hello world") # Batch results = embed.map(["hello", "world", "foo"]) # Streaming (for LLMs) for token in generate.stream("Tell me a joke"): print(token, end="", flush=True) # Async job = embed.remote_async("hello") result = job.result() ``` -------------------------------- ### Set API key via environment variable Source: https://github.com/zylora-dev/zylora-python/blob/main/README.md Export the ZYLORA_API_KEY environment variable for authentication. ```bash export ZYLORA_API_KEY="zy_live_..." ``` -------------------------------- ### Client API without decorator Source: https://github.com/zylora-dev/zylora-python/blob/main/README.md Use the Zylora client to invoke a function by name and payload without using the decorator. ```python from zylora import Zylora zy = Zylora() result = zy.invoke("embed", {"text": "hello"}) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.