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
Release history Release notifications | RSS feed
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.10.tar.gz
(13.4 kB
view details)
Built Distribution
flymyai-0.1.10-py3-none-any.whl
(17.0 kB
view details)
File details
Details for the file flymyai-0.1.10.tar.gz
.
File metadata
- Download URL: flymyai-0.1.10.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | db8cd57a9bf83b17c747af81a16b07979790ee813290b500f03327cc64928cdf |
|
MD5 | 3cedb81a9871e7b82133958e76466d27 |
|
BLAKE2b-256 | abdecf69566c9705ce10fc68715dd2c3160c00f0a8f804dee753e8e8a6597b21 |
File details
Details for the file flymyai-0.1.10-py3-none-any.whl
.
File metadata
- Download URL: flymyai-0.1.10-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | a937bebb6aa9141d9480189c6e29b68ebebf2f3681b66ed4647127859f19f2a3 |
|
MD5 | f24f6486a5a3c783089f2b2317516494 |
|
BLAKE2b-256 | 2328b332017a3ec493de7fe8f508e51b5b0fbcfb8e62dee632d2cc87fb4936e2 |