Skip to content

Instantly share code, notes, and snippets.

@tendstofortytwo
Created December 14, 2017 08:39
Show Gist options
  • Save tendstofortytwo/ed9c7b3ee0745ea746142da4629d9cb3 to your computer and use it in GitHub Desktop.
Save tendstofortytwo/ed9c7b3ee0745ea746142da4629d9cb3 to your computer and use it in GitHub Desktop.
Origami-lib sendGraphArray example
import cv2
import origami
# all memory/processor intensive work that is to be done only once (like loading models) goes here
# replace $TOKEN with your app token generated by web app
app = origami.register('$TOKEN')
@origami.crossdomain
@app.listen()
def hello():
# graph type can be set in webapp
graph_1 = [
{ 'x': 1, 'y': 1 },
{ 'x': 2, 'y': 3 },
{ 'x': 3, 'y': 9 },
{ 'x': 4, 'y': 6 },
{ 'x': 5, 'y': 4 }
]
graph_2 = [
{ 'x': 1, 'y': 2 },
{ 'x': 2, 'y': 5 },
{ 'x': 3, 'y': 7 },
{ 'x': 4, 'y': 8 },
{ 'x': 5, 'y': 0 }
]
origami.sendGraphArray([graph_1, graph_2])
return 'OK'
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment