update README section 3
Browse files
README.md
CHANGED
@@ -84,13 +84,17 @@ idx2label = {v:k for k,v in label2idx.items()}
|
|
84 |
|
85 |
3. Change your sentence here
|
86 |
```python
|
|
|
|
|
|
|
87 |
test_sen = '上丞相康思公書'
|
88 |
pred_class_proba = predict_class(test_sen)
|
89 |
print(f'The predicted probability for the {list(pred_class_proba.keys())[0]} class: {list(pred_class_proba.values())[0]}')
|
90 |
print(f'The predicted probability for the {list(pred_class_proba.keys())[1]} class: {list(pred_class_proba.values())[1]}')
|
91 |
-
|
|
|
92 |
pred_class = idx2label[np.argmax(list(pred_class_proba.values()))]
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
```
|
|
|
84 |
|
85 |
3. Change your sentence here
|
86 |
```python
|
87 |
+
label2idx = {'not-letter': 0,'letter': 1}
|
88 |
+
idx2label = {v:k for k,v in label2idx.items()}
|
89 |
+
|
90 |
test_sen = '上丞相康思公書'
|
91 |
pred_class_proba = predict_class(test_sen)
|
92 |
print(f'The predicted probability for the {list(pred_class_proba.keys())[0]} class: {list(pred_class_proba.values())[0]}')
|
93 |
print(f'The predicted probability for the {list(pred_class_proba.keys())[1]} class: {list(pred_class_proba.values())[1]}')
|
94 |
+
>>> The predicted probability for the not-letter class: 0.002029061783105135
|
95 |
+
>>> The predicted probability for the letter class: 0.9979709386825562
|
96 |
pred_class = idx2label[np.argmax(list(pred_class_proba.values()))]
|
97 |
+
|
98 |
+
print(f'The predicted class is: {pred_class}')
|
99 |
+
>>> The predicted class is: letter
|
100 |
```
|