Spaces:
Runtime error
Runtime error
Topallaj Denis
commited on
Commit
•
b9b612c
1
Parent(s):
c7272f2
load the models before the endpoint is called
Browse files
main.py
CHANGED
@@ -22,6 +22,12 @@ app.add_middleware(
|
|
22 |
allow_headers=["*"]
|
23 |
)
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
@app.get("/predict")
|
26 |
def predict_UniKP_values(
|
27 |
sequence: str,
|
@@ -41,11 +47,8 @@ def predict_UniKP_values(
|
|
41 |
class EndpointHandler():
|
42 |
def __init__(self, path=""):
|
43 |
|
44 |
-
|
45 |
-
self.
|
46 |
-
"Rostlab/prot_t5_xl_half_uniref50-enc", do_lower_case=False, torch_dtype=torch.float16)
|
47 |
-
self.model = T5EncoderModel.from_pretrained(
|
48 |
-
"Rostlab/prot_t5_xl_half_uniref50-enc")
|
49 |
|
50 |
# path to the vocab_content and trfm model
|
51 |
vocab_content_path = f"{path}/vocab_content.txt"
|
|
|
22 |
allow_headers=["*"]
|
23 |
)
|
24 |
|
25 |
+
tokenizer = T5Tokenizer.from_pretrained(
|
26 |
+
"Rostlab/prot_t5_xl_half_uniref50-enc", do_lower_case=False, torch_dtype=torch.float16)
|
27 |
+
|
28 |
+
model = T5EncoderModel.from_pretrained(
|
29 |
+
"Rostlab/prot_t5_xl_half_uniref50-enc")
|
30 |
+
|
31 |
@app.get("/predict")
|
32 |
def predict_UniKP_values(
|
33 |
sequence: str,
|
|
|
47 |
class EndpointHandler():
|
48 |
def __init__(self, path=""):
|
49 |
|
50 |
+
self.tokenizer = tokenizer
|
51 |
+
self.model = model
|
|
|
|
|
|
|
52 |
|
53 |
# path to the vocab_content and trfm model
|
54 |
vocab_content_path = f"{path}/vocab_content.txt"
|