Skip to main content

No project description provided

Project description

FlyMy.AI

Generated with FlyMy.AI in 🚀 70ms
Generated with FlyMy.AI in 🚀 70ms

Welcome to FlyMy.AI inference platform. Our goal is to provide the fastest and most affordable deployment solutions for neural networks and AI applications.

  • Fast Inference: Experience the fastest Stable Diffusion inference globally.
  • Scalability: Autoscaling to millions of users per second.
  • Ease of Use: One-click deployment for any publicly available neural networks.

Website

For more information, visit our website: FlyMy.AI Or connect with us and other users on Discord: Join Discord

Getting Started

This is a Python client for FlyMyAI. It allows you to easily run models and get predictions from your Python code in sync and async mode.

Requirements

  • Python 3.10+

Installation

Install the FlyMyAI client using pip:

pip install flymyai-client

Authentication

Before using the client, you need to have your API key, username, and project name. In order to get credentials, you have to sign up on flymy.ai and get your personal data on the profile.

Basic Usage

Llama3_8b chat model

Here's a simple example of how to use the FlyMyAI client:

import flymyai

response = flymyai.run(
    auth={
        "apikey": "fly-secret-key",
        "username": "flymyai",
        "project_name": "llama-v3-8b",
    },
    payload=
    {
        "i_prompt": f"You discover the last library in the world, hidden in a forgotten city. What secrets does it hold, and why is it protected by ancient guardians?"
    }
)
print(response.output_data["o_output"][0])

or

BERT Sentiment analysis

import flymyai

response = flymyai.run(
    auth={
        "apikey": "fly-secret-key",
        "username": "flymyai",
        "project_name": "bert",
    },
    payload={"i_text": "What a fabulous fancy building! It looks like a palace!"}
)
print(response.output_data["o_logits"][0])

File Inputs

ResNet image classification

You can pass file inputs to models using file paths:

import flymyai
import pathlib

response = flymyai.run(
    auth={
        "apikey": "fly-secret-key",
        "username": "flymyai",
        "project_name": "resnet",
    },
    payload={"i_image": pathlib.Path("/path/to/image.png")}
)
print(response.output_data["o_495"])

File Response Handling

Files received from the neural network are always encoded in base64 format. To process these files, you need to decode them first. Here's an example of how to handle an image file:

StableDiffusion Turbo image generation in ~50ms 🚀

import base64
import flymyai

response = flymyai.run(
    auth={
        "apikey": "fly-secret-key",
        "username": "flymyai",
        "project_name": "SDTurboFMAAceleratedH100",
    },
    payload={
        "i_prompt": "An astronaut riding a rainbow unicorn, cinematic, dramatic, photorealistic",
        "i_negative_prompt": "Dark colors, gloomy atmosphere, horror",
        "i_seed": 42,
        "i_denoising_steps": 25
    }
)
base64_image = response.output_data["o_sample"][0]
image_data = base64.b64decode(base64_image)
with open("generated_image.jpg", "wb") as file:
    file.write(image_data)

Asynchronous Requests

FlyMyAI supports asynchronous requests for improved performance. Here's how to use it:

import asyncio
import flymyai


async def main():
    auth = {
        "apikey": "fly-secret-key",
        "username": "flymyai",
        "project_name": "llama-v3-8b",
    }
    prompts = [
        {"i_prompt": f"Some random stuff number {count}"}
        for count in range(1, 10)
    ]
    async with asyncio.TaskGroup() as gr:
        tasks = [
            gr.create_task(flymyai.async_run(auth, payload=prompt))
            for prompt in prompts
        ]
    results = await asyncio.gather(*tasks)
    for result in results:
        print(result.output_data["o_output"])


asyncio.run(main())

Running Models in the Background

To run a model in the background, simply use the async_run() method:

import asyncio
import flymyai
import pathlib


async def background_task():
    auth = {
        "apikey": "fly-secret-key",
        "username": "flymyai",
        "project_name": "whisper"
    }
    payload = {"i_audio": pathlib.Path("/path/to/audio.mp3")}
    response = await flymyai.async_run(auth, payload=payload)
    print("Background task completed:", response.output_data["o_transcription"])


async def main():
    task = asyncio.create_task(background_task())
    await task

asyncio.run(main())
# Continue with other operations while the model runs in the background

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

Uploaded Source

Built Distribution

flymyai-1.0.15-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flymyai-1.0.15.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Linux/6.5.0-1022-azure

File hashes

Hashes for flymyai-1.0.15.tar.gz
Algorithm Hash digest
SHA256 9193806c87a6f4d6f3ce57704895aaa83e44e709c6f491c106b4030bac37664b
MD5 bbbbd86d7075f1d5ab8f4f96a3065fb7
BLAKE2b-256 6f49fd9e796fd4f7566958a2d17e289f9dbf93f435ae0ddf667e9d1a8a1af4da

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flymyai-1.0.15-py3-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Linux/6.5.0-1022-azure

File hashes

Hashes for flymyai-1.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 3d7f7428006f38cbd6701f461f4b7ecdc5a80d8c69257b5a3876fd228f28ef00
MD5 aacc8d87cd137b2cca1f96e6692802be
BLAKE2b-256 c191ee0dc9859328a7c4b0dc13400704486fe61e39257bcdc4ac406fe26662ac

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