Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|