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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: flymyai-0.1.9.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.9.tar.gz
Algorithm Hash digest
SHA256 7bc15bc41826995285f98bca8ff633bee275efae880e49b67ff91fbb35efe57b
MD5 7dba001a09a887e7ef6cecd381bdca38
BLAKE2b-256 2a8e10b9e9ea2e4738d9daef3a8fa7808b75c89388333ef69587abea17a459ea

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flymyai-0.1.9-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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 69b361545f5142cd7dcdf1b2f54acd080b5c06dafcc6f12a85696afca8594414
MD5 b22985f8d3d683bfb28111f743d6cf56
BLAKE2b-256 7537392d8151bc7a1e523d3e55419d52cadc72dec5208181779d55355867ede1

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