FremyCompany
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -66,6 +66,7 @@ else:
|
|
66 |
|
67 |
## Load the model
|
68 |
import transformers
|
|
|
69 |
|
70 |
import torch
|
71 |
import torch.nn.functional as F
|
@@ -80,7 +81,8 @@ else:
|
|
80 |
|
81 |
model, tokenizer = load_model_and_tokenizer()
|
82 |
|
83 |
-
@st.
|
|
|
84 |
def encode_sentences(sent0, sent1):
|
85 |
sentences = [sent0, sent1]
|
86 |
tokens = []
|
|
|
66 |
|
67 |
## Load the model
|
68 |
import transformers
|
69 |
+
from functools import lru_cache
|
70 |
|
71 |
import torch
|
72 |
import torch.nn.functional as F
|
|
|
81 |
|
82 |
model, tokenizer = load_model_and_tokenizer()
|
83 |
|
84 |
+
@st.cache_resource
|
85 |
+
@lru_cache(maxsize=128)
|
86 |
def encode_sentences(sent0, sent1):
|
87 |
sentences = [sent0, sent1]
|
88 |
tokens = []
|