Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/raymondcm/simpledatatransport

Simple python 2/3 library for transporting data to a remote machine, applying transformations and returning a response.
https://github.com/raymondcm/simpledatatransport

flask images python-library python3

Last synced: about 1 month ago
JSON representation

Simple python 2/3 library for transporting data to a remote machine, applying transformations and returning a response.

Awesome Lists containing this project

README

        

# SimpleDataTransport

Simple python 3 library for transporting images to a remote machine, applying transformations and returning a response.

## Usage

Start a server on the remote machine:

```python
from SimpleDataTransport import DataReceiver

# Callback takes a single dict with an image and returns a dict of useful data
def example_callback(data):
img = data["image"]
return {'message': 'image received. size={}x{}'.format(img.shape[1], img.shape[0])}

# Initialize the Flask application
flask_receiver = DataReceiver()
flask_receiver.set_callback(example_callback)
flask_receiver.run()
```

On the local machine you can send an image and get an appropriate response:

```python
from SimpleDataTransport import DataSender
import numpy as np

img = np.zeros((1080, 1920))

response = DataSender(img)
print(response) # {'message': 'image received. size=1920x1080'}
```