I am trying to find sentence similarities using the universal sentence encoding model. I have universal sentence encoder model form saved on the local drive. But I don't know how to call it through the code directly from the local drive below instead of calling it through the link in the code. Note that my OS is windows.
import tensorflow as tf
import tensorflow_hub as hub
embed = hub.Module("https://tfhub.dev/google/universal-sentence-encoder-large/3")
def get_features(texts):
if type(texts) is str:
texts = [texts]
with tf.Session() as sess:
sess.run([tf.global_variables_initializer(), tf.tables_initializer()])
return sess.run(embed(texts))
get_features("The quick brown fox jumps over the lazy dog.I am a sentence for which I would like to get its embedding")
