def test_bert_embeddings():
    event = nuclio.Event(body=json.dumps(['John loves Mary']))
    ctx = nuclio.Context()
    init_context(ctx)
    outputs = pickle.loads(handler(ctx, event))
    assert (True if abs(np.mean(outputs[0]) - -0.011996539) <= 0.0001 else
            False) is True
    assert (True
            if abs(np.mean(outputs[0]) - -0.011996539) > 0 else False) is True
예제 #2
0
def fake_nuclio_context(body, headers=None):
    return nuclio.Context(), nuclio.Event(body=body, headers=headers)
예제 #3
0
def test_bert_embeddings():
    event = nuclio.Event(body=json.dumps(['John loves Mary']))
    ctx = nuclio.Context()
    init_context(ctx)
    outputs = pickle.loads(handler(ctx, event))
    print(outputs)