SatAT commited on
Commit
2128722
·
1 Parent(s): 24a231f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -15,10 +15,10 @@ text = st.text_area("TEXT HERE")
15
  # ^-- показать текстовое поле. В поле text лежит строка, которая находится там в данный момент
16
 
17
  tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
18
- model = BertForSequenceClassification.from_pretrained
19
  "bert-base-uncased", # Use the 12-layer BERT model, with an uncased vocab.
20
  num_labels = 44,)
21
-
22
  MAX_LEN = 64
23
  tokens = tokenizer.encode_plus(text, add_special_tokens=True, max_length=MAX_LEN, truncation=True, padding='max_length')
24
  input_ids = torch.tensor(tokens['input_ids']).unsqueeze(0)
 
15
  # ^-- показать текстовое поле. В поле text лежит строка, которая находится там в данный момент
16
 
17
  tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
18
+ model = BertForSequenceClassification.from_pretrained(
19
  "bert-base-uncased", # Use the 12-layer BERT model, with an uncased vocab.
20
  num_labels = 44,)
21
+ model.load_state_dict(torch.load("model_last_version.pt", map_location=torch.device('cpu')))
22
  MAX_LEN = 64
23
  tokens = tokenizer.encode_plus(text, add_special_tokens=True, max_length=MAX_LEN, truncation=True, padding='max_length')
24
  input_ids = torch.tensor(tokens['input_ids']).unsqueeze(0)