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_client-0.1.3.tar.gz
(9.4 kB
view details)
Built Distribution
File details
Details for the file flymyai_client-0.1.3.tar.gz
.
File metadata
- Download URL: flymyai_client-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 007f4fe111bd33837befbc5dfea025299976bdb9b57ef33d9e222a1eb6bd7359 |
|
MD5 | 20b48f1d6aa23a60a3a5d162a3a6a7cc |
|
BLAKE2b-256 | e598b954a8b5712bb4baa0fd3a4d09bd07a5754dcc0246a3240b5d921bf724a8 |
File details
Details for the file flymyai_client-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: flymyai_client-0.1.3-py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 969e533f31a76171e9baec5ac3022fb8c93ce803d9dec49cf09137a0077e703c |
|
MD5 | ee11d2c89d99f676bcc88b2400d5aab5 |
|
BLAKE2b-256 | 3246c3af33bdba853fa22a878015d121674a69d50196c2640f540b254c5dcaa8 |