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.4.tar.gz
(13.4 kB
view details)
Built Distribution
flymyai-0.1.4-py3-none-any.whl
(17.0 kB
view details)
File details
Details for the file flymyai-0.1.4.tar.gz
.
File metadata
- Download URL: flymyai-0.1.4.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 | a98f4f73d51f01093b470fecc747b61cfa2a8fda521165ec8e692d1989e9cf67 |
|
MD5 | d28f61f135b6d6589cbf1fbe99fee771 |
|
BLAKE2b-256 | 5e5f126b260c483b81637df0f2cd430a5e91b6e031f2e5ba4322d812d0539fcf |
File details
Details for the file flymyai-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: flymyai-0.1.4-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 | e9e930c7dd4d15cecc76b0a74a00563d0dbcc4c47e3a453284e92feb22e690de |
|
MD5 | 50bbf4289d0a2cd8730d92ca06e6611f |
|
BLAKE2b-256 | b575a07dcc2b0bcc6977b5d7a069154e812487082d72def7726e2f8a7342b130 |