Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -12,10 +12,12 @@ from huggingface_hub import hf_hub_download
|
|
12 |
|
13 |
model_path = hf_hub_download(repo_id="cis-lmu/glotlid", filename="model.bin")
|
14 |
identification_model = fasttext.load_model(model_path)
|
|
|
|
|
15 |
def lang_ident(text):
|
16 |
label, array = identification_model.predict(text)
|
17 |
label = get_name(label[0].split('__')[-1].replace('_Hans', '_Hani').replace('_Hant', '_Hani'))
|
18 |
-
return {language : label
|
19 |
|
20 |
pretrained_model: str = "facebook/m2m100_1.2B"
|
21 |
cache_dir: str = "models/"
|
|
|
12 |
|
13 |
model_path = hf_hub_download(repo_id="cis-lmu/glotlid", filename="model.bin")
|
14 |
identification_model = fasttext.load_model(model_path)
|
15 |
+
|
16 |
+
|
17 |
def lang_ident(text):
|
18 |
label, array = identification_model.predict(text)
|
19 |
label = get_name(label[0].split('__')[-1].replace('_Hans', '_Hani').replace('_Hant', '_Hani'))
|
20 |
+
return {"language" : label, "score" : array[0]}
|
21 |
|
22 |
pretrained_model: str = "facebook/m2m100_1.2B"
|
23 |
cache_dir: str = "models/"
|