Metadata-Version: 2.1
Name: skyfi-modelship
Version: 0.3.0
Summary: SkyFi ModelShip - The Insights partners integration library.
License: MIT
Author: Atanas Balevski
Author-email: nasko@skyfi.com
Requires-Python: >=3.9,<3.12
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: fastapi (>=0.103.2,<0.104.0)
Requires-Dist: geojson-pydantic (>=1.0.1,<2.0.0)
Requires-Dist: google-cloud-storage (>=2.11.0,<3.0.0)
Requires-Dist: loguru (>=0.7.2,<0.8.0)
Requires-Dist: orjson (>=3.9.7,<4.0.0)
Requires-Dist: pika (>=1.3.2,<2.0.0)
Requires-Dist: pydantic (>=2.4.2,<3.0.0)
Requires-Dist: pydantic-settings (>=2.0.3,<3.0.0)
Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
Requires-Dist: shapely (>=2.0.1,<3.0.0)
Requires-Dist: simple-parsing (>=0.1.4,<0.2.0)
Requires-Dist: uvicorn[standard] (>=0.23.2,<0.24.0)
Description-Content-Type: text/markdown

# SkyFi ModelShip library

[![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![PyPI version](https://badge.fury.io/py/skyfi-modelship.svg)](https://badge.fury.io/py/skyfi-modelship)

## Introduction

**SkyFi ModelShip** is a Python library designed to help **Skyfi Insights** partners integrate privately and securely their ML models into SkyFi's infrastructure. It will simplify and optimize the service communication and provide standard input and output parameters to speed up the model development and shorten the time to market for our **Insights** partners. Become a partner for our **Insights** solution on bizdev@skyfi.com

## Key Features

- **Easy Integration:** SkyFi ModelShip will help you integrate your machine learning model into SkyFi's infrastructure using common application structure and input/output parameter types.

- **Model Versioning:** The integration can call an optional bootstrap method, where each integration can decide to check for new versions, download new weights or take other model preparation steps.


## Installation

You can install SkyFi ModelShip from PyPI using pip:

```bash
pip install skyfi-modelship
```

## Getting Started
Create a SkyFi application and decorate your functions:

```python
import skyfi_modelship as skyfi

app = skyfi.SkyfiApp()

@app.bootstrap
def download():
    """Download the model, Optional"""
    logger.info("Downloading model...")


@app.inference
def exec(image: skyfi.Image) -> skyfi.ImageOutput:
    logger.info("Running inference... ")
    return skyfi.ImageOutput(...)

```


## ModelShip Types
The inference function should adhere to `PEP-484` and declare type hints. All types of the parameters and return types should be members of the `skyfi_modelship` package or lists of them.

### Input types
The inference decorated function will receive parameters only from the ModelShip supported input types, or lists of them. They're exported in the `skyfi_modelship` package:

- skyfi_modelship.`int` - Store an integer value.
- skyfi_modelship.`float` - Store a float value.
- skyfi_modelship.`str` - Store a str value.
- skyfi_modelship.`Polygon` - Store a polygon as a wkt string.
- skyfi_modelship.`GeoJSON` - Store a GeoJSON Feature Object.
- skyfi_modelship.`ImageType` - Supported image types.
- skyfi_modelship.`Image` - Store an image path and type.

### Output types
The inference decorated function should return objects that are from the ModelShip output types or lists of them. They're exported in the `skyfi_modelship` package:

- skyfi_modelship.`IntOutput` - Output class for integers.
- skyfi_modelship.`FloatOutput` - Output class for floats.
- skyfi_modelship.`StrOutput` - Output class for strings.
- skyfi_modelship.`PolygonOutput` - Output class for polygons.
- skyfi_modelship.`GeoJSONOutput` - Output class for GeoJSON features.
- skyfi_modelship.`ImageOutput` - Output class for images.

## Distribution
1. Create a `Dockerfile` for your project, e.g.:
```
FROM python:3.9.5-slim-buster

WORKDIR /app

COPY requirements.txt main.py ./
RUN python -m pip install --no-cache-dir -v -r requirements.txt

CMD ["python", "main.py"]

```

2. Send your container image to SkyFi
Please contact bizdev@skyfi.com and discuss how we can privately access the container image.

## Examples

Check out the [example](https://github.com/optisense/skyfi-modelship/tree/main/example) directory to see a working example and get inspired!

## License

This project is licensed under the [MIT License](https://github.com/optisense/skyfi-modelship/tree/main/LICENSE).

## Contact

If you have any questions or feedback, feel free to reach out at [bizdev@skyfi.com](mailto:bizdev@skyfi.com).

---

Unlock the true potential of your models with SkyFi Insights - Get started now!

