Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ from transformers import BertTokenizer, BertForSequenceClassification
|
|
| 6 |
# Load pre-trained BERT model and tokenizer
|
| 7 |
tokenizer = BertTokenizer.from_pretrained("bert-base-uncased")
|
| 8 |
model = BertForSequenceClassification.from_pretrained("bert-base-uncased", num_labels=6)
|
| 9 |
-
model.load_state_dict(torch.load('/path/to/
|
| 10 |
model.eval()
|
| 11 |
|
| 12 |
# Define function for classification
|
|
|
|
| 6 |
# Load pre-trained BERT model and tokenizer
|
| 7 |
tokenizer = BertTokenizer.from_pretrained("bert-base-uncased")
|
| 8 |
model = BertForSequenceClassification.from_pretrained("bert-base-uncased", num_labels=6)
|
| 9 |
+
model.load_state_dict(torch.load('/path/to/model.pt', map_location=torch.device('cpu'))) # Replace with the correct path to your pre-trained model weights file
|
| 10 |
model.eval()
|
| 11 |
|
| 12 |
# Define function for classification
|