cool commited on
Commit
4a9f14a
·
verified ·
1 Parent(s): 957eb01

Update install_model.py

Browse files
Files changed (1) hide show
  1. install_model.py +11 -7
install_model.py CHANGED
@@ -1,10 +1,14 @@
1
  import argostranslate.package
2
  import os
3
 
4
- model_path = "/app/models/en_kab_comp"
5
- if os.path.isdir(model_path):
6
- package = argostranslate.package.Package(model_path)
7
- argostranslate.package.install_from_path(package)
8
- print("Kabyle model installed.")
9
- else:
10
- print("Model path not found.")
 
 
 
 
 
1
  import argostranslate.package
2
  import os
3
 
4
+ model_dir = "/app/models"
5
+
6
+ if not os.path.isdir(model_dir):
7
+ print(f"Model directory {model_dir} not found.")
8
+ exit(1)
9
+
10
+ for filename in os.listdir(model_dir):
11
+ if filename.endswith(".argosmodel"):
12
+ model_path = os.path.join(model_dir, filename)
13
+ print(f"Installing model: {model_path}")
14
+ argostranslate.package.install_from_path(model_path)