alexrods commited on
Commit
d1aaae4
1 Parent(s): 65423b9

Create inference.py

Browse files
Files changed (1) hide show
  1. inference.py +11 -0
inference.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from torchtext.data.utils import get_tokenizer
3
+ from model_arch import TextClassifierModel
4
+
5
+ model_loaded = torch.load('model_checkpoint.pth')
6
+ vocab = torch.load('vocab.pt')
7
+ tokenizer = get_tokenizer("spacy", language="es")
8
+
9
+ text_pipeline = lambda x: vocab(tokenizer(x))
10
+
11
+