Giter Site home page Giter Site logo

straup / plumbing-shannon-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cooperhewitt/plumbing-shannon-server

0.0 1.0 0.0 106 KB

A simple HTTP pony server for extracting "Shannon-related" properties from images.

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%

plumbing-shannon-server's Introduction

plumbing-shannon-server

A simple Flask-based HTTP pony server for extracting "Shannon-related" properties from images.

Install

python ./setup.py install

Example

The setup.py script will install the shannon-server.py in /usr/local/bin (or your operating system's equivalent) but you can also run it directly like this:

python ./script/shannon-server.py -c server.cfg
INFO:werkzeug: * Running on http://127.0.0.1:5000/

Or

setenv SHANNON_SERVER_CONFIG server.cfg
python ./scripts/shannon-server.py
INFO:werkzeug: * Running on http://127.0.0.1:5000/

You can also run shannon-server from any WSGI-compliant container-server-thing-y. Consult the init.d folder for an example of how to use shannon-server with gunicorn.

Endpoints

GET /ping

curl -X GET 'http://localhost:5000/ping'

{
	"stat": "ok"
}

GET /entropy

curl -X GET 'http://localhost:5000/entropy?file=test.png'

{
	"entropy": 9.386720101697886, 
}

POST /entropy

curl -X POST -F 'file=@/tmp/test.jpg' 'http://localhost:5000/entropy'

{
	"entropy": 9.386720101697886, 
}

GET /focalpoint

curl -X GET 'http://localhost:5000/focalpoint?file=test.png'

{
	"entropy": 9.386720101697886, 
	"h": 480, 
	"w": 640, 
	"x": 100, 
	"y": 180
}

POST /focalpoint

curl -X POST -F 'file=@/tmp/test.jpg' 'http://localhost:5000/focalpoint'

{
	"entropy": 9.386720101697886, 
	"h": 480, 
	"w": 640, 
	"x": 100, 
	"y": 180
}

Config

plumbing-shannon-server uses utility functions exported by the cooperhewitt.flask.http_pony library which checks your Flask application's configuration for details about how to handle things.

The following settings should be added to a standard ini style configutation file.

[flask]

port

The Unix TCP port you want your Flask server to listen on.

[http_pony]

local_path_root

If set then files sent using an HTTP GET parameter will be limited to only those that are are parented by this directory.

If it is not set then HTTP GET requests will fail.

upload_path_root

If set then files sent as an HTTP POST request will be first written to this directory before processing.

If not set then the operating system's temporary directory will be used.

allowed_extensions

A comma-separate list of valid file extensions for processing.

See also

plumbing-shannon-server's People

Contributors

thisisaaronland avatar copea avatar

Watchers

Aaron Straup Cope avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.