Update README.md
Browse files
README.md
CHANGED
|
@@ -105,6 +105,16 @@ def predict_memory_type(text):
|
|
| 105 |
return model.config.id2label[predicted_id]
|
| 106 |
|
| 107 |
predict_memory_type("Without a map, I navigated the winding back roads to reach my childhood home.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
```
|
| 109 |
|
| 110 |
## Citation
|
|
|
|
| 105 |
return model.config.id2label[predicted_id]
|
| 106 |
|
| 107 |
predict_memory_type("Without a map, I navigated the winding back roads to reach my childhood home.")
|
| 108 |
+
```
|
| 109 |
+
or via huggingface pipeline
|
| 110 |
+
```python
|
| 111 |
+
# Use a pipeline as a high-level helper
|
| 112 |
+
from transformers import pipeline
|
| 113 |
+
import torch
|
| 114 |
+
device = 0 if torch.cuda.is_available() else -1 # 0 = GPU, -1 = CPU
|
| 115 |
+
pipe = pipeline("text-classification", model="DimitriosPanagoulias/MemoryBERT", device=device)
|
| 116 |
+
pipe("I remember the long walk to my childhood school.")
|
| 117 |
+
|
| 118 |
```
|
| 119 |
|
| 120 |
## Citation
|