Created
May 19, 2016 11:14
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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