Last active
March 10, 2017 08:42
-
-
Save tocttou/669c516fd8d4fd0934d188c4f3b5ad39 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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