Update README.md
Browse files
README.md
CHANGED
|
@@ -69,7 +69,7 @@ The model captures **code-switching**, **local idioms**, **indirect expressions*
|
|
| 69 |
|
| 70 |
|
| 71 |
## Task
|
| 72 |
-
```
|
| 73 |
def classify_text(text):
|
| 74 |
"""
|
| 75 |
Run inference on a single text input using the fine‑tuned LusakaLang model.
|
|
@@ -79,18 +79,25 @@ def classify_text(text):
|
|
| 79 |
label = result["label"]
|
| 80 |
score = round(result["score"], 4)
|
| 81 |
return label, score
|
| 82 |
-
|
| 83 |
-
|
| 84 |
samples = [
|
| 85 |
"Muli shani bane, nalishiba bwino.",
|
| 86 |
"How are you doing today?",
|
| 87 |
"Tili bwino, zikomo kwambiri."
|
| 88 |
]
|
| 89 |
-
|
| 90 |
for s in samples:
|
| 91 |
label, score = classify_text(s)
|
| 92 |
print(f"Text: {s}\nPrediction: {label} (confidence={score})\n")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
```
|
| 95 |
---
|
| 96 |
|
|
@@ -102,15 +109,11 @@ for s in samples:
|
|
| 102 |

|
| 103 |
|
| 104 |
|
| 105 |
-
|
| 106 |
-
|
| 107 |

|
| 108 |
|
| 109 |
|
| 110 |
-
|
| 111 |

|
| 112 |
|
| 113 |
|
| 114 |
-
|
| 115 |

|
| 116 |
|
|
|
|
| 69 |
|
| 70 |
|
| 71 |
## Task
|
| 72 |
+
```python
|
| 73 |
def classify_text(text):
|
| 74 |
"""
|
| 75 |
Run inference on a single text input using the fine‑tuned LusakaLang model.
|
|
|
|
| 79 |
label = result["label"]
|
| 80 |
score = round(result["score"], 4)
|
| 81 |
return label, score
|
|
|
|
|
|
|
| 82 |
samples = [
|
| 83 |
"Muli shani bane, nalishiba bwino.",
|
| 84 |
"How are you doing today?",
|
| 85 |
"Tili bwino, zikomo kwambiri."
|
| 86 |
]
|
|
|
|
| 87 |
for s in samples:
|
| 88 |
label, score = classify_text(s)
|
| 89 |
print(f"Text: {s}\nPrediction: {label} (confidence={score})\n")
|
| 90 |
+
```
|
| 91 |
+
Sample Output
|
| 92 |
+
```python
|
| 93 |
+
Text: Muli shani bane, nalishiba bwino.
|
| 94 |
+
Prediction: Bemba (confidence=0.9821)
|
| 95 |
|
| 96 |
+
Text: How are you doing today?
|
| 97 |
+
Prediction: English (confidence=0.9954)
|
| 98 |
+
|
| 99 |
+
Text: Tili bwino, zikomo kwambiri.
|
| 100 |
+
Prediction: Nyanja (confidence=0.9736)
|
| 101 |
```
|
| 102 |
---
|
| 103 |
|
|
|
|
| 109 |

|
| 110 |
|
| 111 |
|
|
|
|
|
|
|
| 112 |

|
| 113 |
|
| 114 |
|
|
|
|
| 115 |

|
| 116 |
|
| 117 |
|
|
|
|
| 118 |

|
| 119 |
|