Cutecat6152 commited on
Commit
58872a2
·
verified ·
1 Parent(s): 610c9ce

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +29 -3
README.md CHANGED
@@ -1,3 +1,29 @@
1
- ---
2
- license: unlicense
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: unlicense
3
+ ---
4
+ # OkayLID
5
+ OkayLID is a language identification model in FastText that is only 3 megabytes, meant for basic language detection. It can detect over 201 languages, at an extremely small size. OkayLID trained on a smaller subset of the OpenLID dataset.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pip install fasttext huggingface_hub
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```python
16
+ import numpy as np
17
+ import fasttext
18
+ from huggingface_hub import hf_hub_download
19
+
20
+ np.array = lambda obj, *args, **kwargs: np.asarray(obj, *args, **{k: v for k, v in kwargs.items() if k != "copy"})
21
+
22
+ model_path = hf_hub_download(repo_id="Cutecat6152/OkayLID", filename="OkayLID.bin")
23
+ model = fasttext.load_model(model_path)
24
+
25
+ text = "The quick brown fox jumps over the lazy dog."
26
+ labels, probs = model.predict(text, k=1)
27
+
28
+ print(f"Language: {labels[0].replace('__label__', '')}")
29
+ ```