Skip to content

Instantly share code, notes, and snippets.

@misgeatgit
Last active December 9, 2020 17:49
Show Gist options
  • Save misgeatgit/c782e2671de23b903bd4597391766177 to your computer and use it in GitHub Desktop.
Save misgeatgit/c782e2671de23b903bd4597391766177 to your computer and use it in GitHub Desktop.
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