Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -10,15 +10,13 @@ import gradio as gr
|
|
10 |
import joblib
|
11 |
import omikuji
|
12 |
from huggingface_hub import snapshot_download
|
13 |
-
from parltopic.utils.helper import get_main_config
|
14 |
from prepare_everything import download_model
|
15 |
|
16 |
-
|
17 |
|
18 |
download_model(
|
19 |
"https://dl.fbaipublicfiles.com/fasttext/supervised-models/lid.176.bin",
|
20 |
-
Path(
|
21 |
-
)
|
22 |
|
23 |
# Download the model files from Hugging Face
|
24 |
|
@@ -35,14 +33,14 @@ for repo_id in model_names:
|
|
35 |
|
36 |
lang_model = fasttext.load_model("lid.176.bin")
|
37 |
|
38 |
-
with open(Path(
|
39 |
label2id = js.load(f)
|
40 |
|
41 |
id2label = {}
|
42 |
|
43 |
for key, value in label2id.items():
|
44 |
id2label[str(value)] = key
|
45 |
-
with open(Path(
|
46 |
topics_hierarchy = js.load(f)
|
47 |
|
48 |
|
|
|
10 |
import joblib
|
11 |
import omikuji
|
12 |
from huggingface_hub import snapshot_download
|
|
|
13 |
from prepare_everything import download_model
|
14 |
|
15 |
+
|
16 |
|
17 |
download_model(
|
18 |
"https://dl.fbaipublicfiles.com/fasttext/supervised-models/lid.176.bin",
|
19 |
+
Path("lid.176.bin")
|
|
|
20 |
|
21 |
# Download the model files from Hugging Face
|
22 |
|
|
|
33 |
|
34 |
lang_model = fasttext.load_model("lid.176.bin")
|
35 |
|
36 |
+
with open(Path("label2id.json"), "r") as f:
|
37 |
label2id = js.load(f)
|
38 |
|
39 |
id2label = {}
|
40 |
|
41 |
for key, value in label2id.items():
|
42 |
id2label[str(value)] = key
|
43 |
+
with open(Path("topics_hierarchy.json"), "r") as f:
|
44 |
topics_hierarchy = js.load(f)
|
45 |
|
46 |
|