Ejemplo n.º 1
0
    def test_predictions_weak(self, client):
        picture = Picture.create(image_id='foobar.jpg')
        algorithm = Algorithm.create(name='DeevioNet', version='1.1')
        prediction = Prediction.create(picture_id=picture.id, algorithm_id=algorithm.id, proba=0.69)
        prediction = Prediction.create(picture_id=picture.id, algorithm_id=algorithm.id, proba=0.7)

        body = json.loads(client.get('/v1/predictions/weak').data)

        assert len(body) == 1
Ejemplo n.º 2
0
    def test_predictions_by_image_id(self, client):
        picture = Picture.create(image_id='foobar.jpg')
        algorithm = Algorithm.create(name='DeevioNet', version='1.1')
        prediction = Prediction.create(picture_id=picture.id, algorithm_id=algorithm.id, proba=0.99, status='complete', label='nail', result='good', bbox=[100, 200, 500, 500])

        body = json.loads(client.get('/v1/predictions/%s' % 'foobar.jpg').data)

        assert body['probability'] == prediction.proba
        assert body['status'] == prediction.status
        assert body['label'] == prediction.label
        assert body['result'] == prediction.result
        assert body['bbox'] == prediction.bbox
        assert body['algorithm']['type'] == 'GET'
        assert body['algorithm']['rel'] == 'algorithm'
        assert body['algorithm']['href'] == '/v1/algorithm/DeevioNet?version=1.1'
        assert body['picture']['type'] == 'GET'
        assert body['picture']['rel'] == 'picture'
        assert body['picture']['href'] == '/v1/picture/foobar.jpg'
Ejemplo n.º 3
0
 def test_prediction_create_algorithm(self):
     algorithm = Algorithm.create()
     prediction = Prediction.create(algorithm_id=algorithm.id)
     assert prediction.algorithm == algorithm
     assert algorithm.predictions[-1] == prediction
Ejemplo n.º 4
0
 def test_algorithm_create_version(self, version):
     assert Algorithm.create(version=version).version == version
Ejemplo n.º 5
0
 def test_algorithm_create_name(self, name):
     assert Algorithm.create(name=name).name == name
Ejemplo n.º 6
0
 def test_algorithm_init(self, name):
     assert Algorithm(name=name).name == name
Ejemplo n.º 7
0
 def test_get_algorithm(self, client):
     algorithm = Algorithm.create(name='DeevioNet', version='1.1')
     body = json.loads(client.get('/v1/algorithm/' + algorithm.name + '?version=' + algorithm.version).data)
     assert body['name'] == 'DeevioNet'
     assert body['version'] == '1.1'
Ejemplo n.º 8
0
def algorithm(name):
    version = request.args.get('version')
    algorithm = Algorithm.find_by(name=name, version=version)
    return jsonify(AlgorithmPresenter(algorithm).to_dict())