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.8.tar.gz
(13.4 kB
view details)
Built Distribution
flymyai-0.1.8-py3-none-any.whl
(17.0 kB
view details)
File details
Details for the file flymyai-0.1.8.tar.gz
.
File metadata
- Download URL: flymyai-0.1.8.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 | 024d62d9594e162d431db5b7b194198d1264b0b4090e5946fd707756f2eb6777 |
|
MD5 | a3019cb1c100901f1e1c06e5bd4b2372 |
|
BLAKE2b-256 | 8353db37d43d2a0719fb6c900a03e340291a6fa04958aed581a9933d3ea08a49 |
File details
Details for the file flymyai-0.1.8-py3-none-any.whl
.
File metadata
- Download URL: flymyai-0.1.8-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 | 795d6773cff165fdec18ef5135deed31cca4f454ed41822348fe5eedf13355de |
|
MD5 | 68d8eb5b87d00a3a1724d9d5b2aa9783 |
|
BLAKE2b-256 | 645c4d121dc38a1fb6d48f030e146544214c3e5c08d398e3fdf00c92bc24b8cd |