Skip to content

Instantly share code, notes, and snippets.

@whizzmler
Created May 19, 2016 11:14
Show Gist options
  • Save whizzmler/8a849c282a770ac79a1441df5c5ccf62 to your computer and use it in GitHub Desktop.
Save whizzmler/8a849c282a770ac79a1441df5c5ccf62 to your computer and use it in GitHub Desktop.
A simple example of WhizzML resource handling at the API level, in Python
#!/usr/bin/env python
"""A simple WhizzML example
"""
from bigml.api import BigML
API = BigML()
LIBRARY = API.create_library("(define (addition a b) (+ a b))")
API.ok(LIBRARY)
SCRIPT = API.create_script("(addition x 2)", {
"imports": [LIBRARY['resource']],
"inputs": [{"name": "x", "type": "number"}]})
API.ok(SCRIPT)
EXECUTION = API.create_execution(SCRIPT['resource'], {"inputs": [["x", 5]]})
API.ok(EXECUTION)
print EXECUTION['object']['execution']['result']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment