{% extends 'bootstrap/base.html' %} {% import 'bootstrap/fixes.html' as fixes %} {% block title %}d3cryp7.py{% endblock %} {% block head %} {{super()}} {{fixes.ie8()}} {% endblock %} {% block content %}

Documentation

Home

Examples

Curl

$ curl http://{{ host }}:{{ port }}/api/statistics
$ curl http://{{ host }}:{{ port }}/api/cost
$ curl http://{{ host }}:{{ port }}/api/recognize -F "image=<base64 encoded image>" -X POST
$ curl http://{{ host }}:{{ port }}/api/tag -F "image=<base64 encoded image>" -X POST
$ curl http://{{ host }}:{{ port }}/api/set_success -F "id=<request id>" -X POST
$ curl http://{{ host }}:{{ port }}/api/set_fail -F "id=<request id>" -X POST

Python Requests

import requests

requests.get('http://{{ host }}:{{ port }}/api/statistics').json()
requests.get('http://{{ host }}:{{ port }}/api/cost').json()
requests.post('http://{{ host }}:{{ port }}/api/recognize', data = {'image': '<base64 encoded image>'}).json()
requests.post('http://{{ host }}:{{ port }}/api/tag', data = {'image': '<base64 encoded image>'}).json()
requests.post('http://{{ host }}:{{ port }}/api/set_success', data = {'id': '<request id>'}).json()
requests.post('http://{{ host }}:{{ port }}/api/set_fail', data = {'id': '<request id>'}).json()

The result of these examples is as follows:


Version

GET

Returns the version of the application

{{ version }}
http://{{ host }}:{{ port }}/api/version

Statistics

GET

Returns statistics about the application and the Python interpreter

{{ stats }}
http://{{ host }}:{{ port }}/api/statistics

Cost

GET

Returns the cost of using the application

{{ cost }}
http://{{ host }}:{{ port }}/api/cost

Recognize

POST

Uses optical character recognition to extract text from an image

Arguments

Name Description
image A base64 encoded image
id The ID of the request
{{ recognize }}
http://{{ host }}:{{ port }}/api/recognize

Tag

POST

Uses machine learning to tag the contents of an image

Arguments

Name Description
image A base64 encoded image
id The ID of the request
{{ tag }}
http://{{ host }}:{{ port }}/api/tag
{% endblock %}