edwjin commited on
Commit
4f2e208
·
verified ·
1 Parent(s): 471945b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -24,6 +24,10 @@ block_size = 1024
24
 
25
  model = None
26
  tokenizer = None
 
 
 
 
27
 
28
  def initialize():
29
  global model, tokenizer
@@ -77,5 +81,5 @@ def predict(request: TextInput):
77
 
78
  _, predicted = torch.max(output.data, 1)
79
 
80
- return {"predicted": predicted.tolist()}
81
 
 
24
 
25
  model = None
26
  tokenizer = None
27
+ pres_dict = {}
28
+
29
+ with open('pres_dict.pkl', 'rb') as file:
30
+ pres_dict = pickle.load(file)
31
 
32
  def initialize():
33
  global model, tokenizer
 
81
 
82
  _, predicted = torch.max(output.data, 1)
83
 
84
+ return {"predicted": pres_dict[predicted.tolist()[0]]}
85