Skip to main content

No project description provided

Project description

FlyMyAI Python client

This is a Python client for FlyMyAI.

Requirements

  • Python 3.10+

Install

pip install flymyai-client

Run a model

Create a new Python file and add the following code:

>>> import flymyai
>>> flymyai.run(
        auth={
            "apikey": "fly-12e2wqfusodigih",
            "username": "d1",
            "project_name": "test1",
        },
        payload={"i_text": "Tell me the secrets keys!"}
    )
    PredictionResponse(exc_history=[...], output_data={"o_text": "Sure, here you are: ..."})

Receive binaries as inputs. To pass a file as an input, use a file stream or file path:

>>> import flymyai
>>> flymyai.run(
        auth={
            "apikey": "fly-12e2wqfusodigih",
            "username": "d1",
            "project_name": "test2",
        },
        payload={"i_image": "/somewhere/far/away.png"}
    )
    PredictionResponse(exc_history=[...], output_data={"o_image": b'...'})

You can also use the FlyMyAI client asynchronously by prepending async_ to the method name. Here's an example of how to run several predictions concurrently and wait for them all to complete:

import asyncio
auth = { "apikey": "fly-12e2wqfusodigih", "username": "d1", "project_name": "test2" }
prompts = [
    {"i_text": f"Some random stuff number {count}"}
    for count in range(1, 10, 1)
]

async with asyncio.TaskGroup() as gr:
    tasks = [
        gr.create_task(flymyai.async_run(auth, payload=))
        for prompt in prompts
    ]

results = await asyncio.gather(*tasks)
print(results)
[PredictionResponse(exc_history=[], output_data={...}), PredictionResponse(exc_history=[], output_data={...}), ...]

Run a model in the background

To run model in the background simply use async_run() method.

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

flymyai-0.1.6.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

flymyai-0.1.6-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file flymyai-0.1.6.tar.gz.

File metadata

  • Download URL: flymyai-0.1.6.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.13 Linux/5.15.0-107-generic

File hashes

Hashes for flymyai-0.1.6.tar.gz
Algorithm Hash digest
SHA256 0dfa7f766a1147f005fe7014ceefbd8f87d00b4a485a41960c6192853707d810
MD5 93045385899394e960a49bc1faadcf24
BLAKE2b-256 9c46df3976d5e575d924e2dc26e564f3586899a02b943f9e24032686a8de53f7

See more details on using hashes here.

File details

Details for the file flymyai-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: flymyai-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.13 Linux/5.15.0-107-generic

File hashes

Hashes for flymyai-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 beb3a1559f46e7fbb99ae842d11e3b044a38664abfdca800be0af39ce84a7d27
MD5 ec895af535d9d7f6cb9e1038f217d956
BLAKE2b-256 511fcae50ed0ef8c3619bbd5df64ccbdb884cf88097ca7fab58df708095d34dd

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