{% extends 'bootstrap/base.html' %} {% import 'bootstrap/fixes.html' as fixes %} {% block title %}d3cryp7.py{% endblock %} {% block head %} {{super()}} {{fixes.ie8()}} {% endblock %} {% block content %}
$ 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
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:
Returns the version of the application
{{ version }}
http://{{ host }}:{{ port }}/api/version
Returns statistics about the application and the Python interpreter
{{ stats }}
http://{{ host }}:{{ port }}/api/statistics
Returns the cost of using the application
{{ cost }}
http://{{ host }}:{{ port }}/api/cost
Uses optical character recognition to extract text from an image
Name | Description |
---|---|
image | A base64 encoded image |
id | The ID of the request |
{{ recognize }}
http://{{ host }}:{{ port }}/api/recognize
Uses machine learning to tag the contents of an image
Name | Description |
---|---|
image | A base64 encoded image |
id | The ID of the request |
{{ tag }}
http://{{ host }}:{{ port }}/api/tag