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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: flymyai-0.1.5.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.5.tar.gz
Algorithm Hash digest
SHA256 4c879df74a0563955dd12951b00e22f1b0a12aaac06ac7e6012b5ed3c2a00db2
MD5 807d2b12347719451b801db2eea4f1d9
BLAKE2b-256 e12fd389ffc158ade4cd4e484c03aab64234db6df2b902ee6b15f93d6c8ea5c0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flymyai-0.1.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d10f1c6c95e3e902da0f01aec0688b5d4a71b9effc851ff023f97517fed9521d
MD5 fdd3400d9d5b710c8ae5ef33f73f92f1
BLAKE2b-256 80d5a28e79562f57773461896b3d6c1f40947c97e11cdf4aada54e97d475137c

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