Last active
December 9, 2020 17:49
-
-
Save misgeatgit/c782e2671de23b903bd4597391766177 to your computer and use it in GitHub Desktop.
This file contains 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 json | |
import time | |
from websocket import create_connection | |
#NOTE: needs installation of pytest and pytest-benchamark libraries | |
sentences = ['How do you treat a migraine?'] | |
uri = "ws://{}:{}{}".format('node1.naint.tech', 8383, '/services/bio_clinical_bert/') | |
ws = create_connection(uri) | |
def get_embedding(sent=sentences[0]): | |
data = {"sentences": sentences, "event": "bio_clinical_bert", "clean_embedding": True} | |
ws.send(json.dumps(data)) | |
responce = json.loads(ws.recv()) | |
return responce | |
def test_embedding(benchmark): | |
benchmark(get_embedding) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment