AshenR commited on
Commit
7cb2fce
·
verified ·
1 Parent(s): 256366d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -36,7 +36,9 @@ tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
36
  modelSentiment = BertForTargetSentiment() # Use the model class defined earlier
37
 
38
  # Load the trained model weights (adjust the path if needed)
39
- modelSentiment.load_state_dict(torch.load('bert_target_sentiment_model.pth'))
 
 
40
  modelSentiment.eval() # Set the model to evaluation mode
41
 
42
  # Sentiment labels
 
36
  modelSentiment = BertForTargetSentiment() # Use the model class defined earlier
37
 
38
  # Load the trained model weights (adjust the path if needed)
39
+ # modelSentiment.load_state_dict(torch.load('bert_target_sentiment_model.pth'))
40
+ modelSentiment.load_state_dict(torch.load('bert_target_sentiment_model.pth', map_location=torch.device('cpu')))
41
+
42
  modelSentiment.eval() # Set the model to evaluation mode
43
 
44
  # Sentiment labels