import cvas client = cvas.client("fpfGmGL99O+3bM1BpV8vSQLeHxxocf+IeLMcKHFwfXU=", "http://localhost:5000") run = client.run("0ca1edcf-a535-4c5f-7048-08d4a22cf837") print(run.std_out)
import cvas import os import json from PIL import Image filename = "grayscale-black-and-white.jpg" client = cvas.client("siOqZKBcJ50GYwAnJYCvh0nAFXUBCg1z7tgPBP/2ib0=", "http://localhost:5000") uploadedFile = client.upload_file(filename) algorithm = client.algorithm("face-detection") arguments = {"input": uploadedFile, "outputType": "text"} result = algorithm.run(arguments) if result.status == "success": print("Success, cropping...") faces = json.loads(result.std_out) original = Image.open(filename) for index, face in enumerate(faces): print(face) cropped = original.crop( (face['x'], face['y'], face['x'] + face['width'], face['y'] + face['height'])) cropped.save('./result/' + str(index) + filename)
import cvas client = cvas.client("zVes/1008G1YhtKNiNa0WY5ZGubLK+DYYu0g+e1hcmQ=", "http://cvas.azurewebsites.net") algorithm = client.algorithm("hello-world") result = algorithm.run(["Hello", "Darkness", "My", "Old", "Friend"]) print("Id: " + result.object_id) print("Result: " + result.status) print("StdOut: " + result.std_out) print("StdErr:" + result.std_err) print("Duration: " + str(result.duration) + " ms")
import cvas import sys client = cvas.client("8bttfegqwfX5Do6rgHIF4t/5Eco7uYm8MoSrpn6p6S8=", "http://localhost:5000") with open("C:\\Users\\adamj\\OneDrive\\Study\\DP\\AlgorithmAssets\\car1.jpg", 'rb') as readFile: file = client.upload_data(readFile.read(), "image/jpeg", ".jpg") if file is None: print("Error with uploading file from data") sys.exit(1) print(file.object_id) algorithm = client.algorithm("license-plate-recognition") result = algorithm.run([{ "c" : "eu", "n": 1}, file]) while result.status == "notFinished": result.get() print("Result: " + result.status) print("StdOut: " + result.std_out) print("StdErr:" + result.std_err) print("Duration: " + str(result.duration) + " ms")