Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
## Usage
|
| 6 |
+
|
| 7 |
+
```python
|
| 8 |
+
state_dict = torch.load('model.pth', map_location='cpu')
|
| 9 |
+
model.load_state_dict(state_dict, strict=False)
|
| 10 |
+
model.eval()
|
| 11 |
+
|
| 12 |
+
def predict(im):
|
| 13 |
+
x = torch.tensor(im, dtype=torch.float32)
|
| 14 |
+
|
| 15 |
+
with torch.no_grad():
|
| 16 |
+
out = model(x)
|
| 17 |
+
|
| 18 |
+
probabilities = F.softmax(out[0], dim=0)
|
| 19 |
+
```
|