Skip to content

Instantly share code, notes, and snippets.

@tocttou
Last active March 10, 2017 08:42
Show Gist options
  • Select an option

  • Save tocttou/669c516fd8d4fd0934d188c4f3b5ad39 to your computer and use it in GitHub Desktop.

Select an option

Save tocttou/669c516fd8d4fd0934d188c4f3b5ad39 to your computer and use it in GitHub Desktop.
import cvfy
import cv2
app = cvfy.register("nongh:0.0.0.0:6162884:5001:8001:localhost:5001")
@cvfy.crossdomain
@app.listen()
def cache_demo():
if cvfy.checkIfCachedResultsExist():
cvfy.sendTextArrayToTerminal(['This result is from cache'])
cvfy.sendImageArray(cvfy.loadImageArrayFromCache(), 'file_path')
else:
cvfy.sendTextArrayToTerminal(['This result is not from cache'])
input_image_path = cv2.imread(cvfy.getImageArray()[0])
grayscale_image = cv2.cvtColor(input_image_path, cv2.COLOR_BGR2GRAY)
cvfy.sendImageArray([grayscale_image], 'numpy_array')
cvfy.saveImageArrayToCache([grayscale_image], 'numpy_array')
return 'OK'
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment