Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/raymondcm/simpledatatransport
- Owner: RaymondCM
- License: mit
- Created: 2019-05-28T09:04:27.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-09-12T11:49:58.000Z (about 5 years ago)
- Last Synced: 2024-10-03T04:40:58.732Z (about 2 months ago)
- Topics: flask, images, python-library, python3
- Language: Python
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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 npimg = np.zeros((1080, 1920))
response = DataSender(img)
print(response) # {'message': 'image received. size=1920x1080'}
```