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.3.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

flymyai-0.1.3-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flymyai-0.1.3.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.13

File hashes

Hashes for flymyai-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d083317f6a8ab4d60fc2e2cb22726ddf169179c978244c3677eb620f24aa1705
MD5 6a869e5b3447553903248c9c255367c5
BLAKE2b-256 2ca9f5cefa8dccc03447ede6b108da37f7a47c5b6bf27359f8119c11c46f1159

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flymyai-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.13

File hashes

Hashes for flymyai-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 fa1be37853654d857465ad325a35607712c4a34c0af4c74bdf1217f21a80b3dc
MD5 247e42ff5336748d8a53f3c35a84fd78
BLAKE2b-256 21f45f51840c88e54833fb10d5287a4d6675d5a29ad6a6f78b78f477cdcc79e7

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