Update README.md
Browse files
README.md
CHANGED
|
@@ -95,10 +95,10 @@ id2label = {idx: label for label, idx in label2id.items()}
|
|
| 95 |
text = "Discover the latest trends in AI and wearable technology."
|
| 96 |
|
| 97 |
with torch.no_grad():
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
```
|
| 103 |
|
| 104 |
📖 Citation
|
|
|
|
| 95 |
text = "Discover the latest trends in AI and wearable technology."
|
| 96 |
|
| 97 |
with torch.no_grad():
|
| 98 |
+
inputs = tokenizer(text, return_tensors="pt", truncation=True)
|
| 99 |
+
outputs = model(**inputs)
|
| 100 |
+
probs = torch.sigmoid(outputs.logits).squeeze().cpu().numpy()
|
| 101 |
+
predicted_labels = [(id2label[i], round(p, 3)) for i, p in enumerate(probs) if p >= 0.5]
|
| 102 |
```
|
| 103 |
|
| 104 |
📖 Citation
|