poltextlab commited on
Commit
a6c2ca7
1 Parent(s): 9009e7c

making the cap model smaller

Browse files
Files changed (1) hide show
  1. interfaces/cap.py +8 -27
interfaces/cap.py CHANGED
@@ -14,19 +14,8 @@ from label_dicts import CAP_NUM_DICT, CAP_LABEL_NAMES
14
  HF_TOKEN = os.environ["hf_read"]
15
 
16
  languages = [
17
- "Danish",
18
- "Dutch",
19
  "English",
20
- "French",
21
- "German",
22
- "Hungarian",
23
- "Italian",
24
- "Polish",
25
- "Portuguese",
26
- "Spanish",
27
- "Czech",
28
- "Slovak",
29
- "Norwegian"
30
  ]
31
 
32
  domains = {
@@ -76,21 +65,13 @@ def build_huggingface_path(language: str, domain: str):
76
  except (AttributeError, FileNotFoundError):
77
  value = None
78
 
79
- if value and value in path_map:
80
- model_path = path_map[value]
81
- if check_huggingface_path(model_path):
82
- # if the model is available on Huggingface, return the path
83
- return model_path
84
- else:
85
- # if the model is not available on Huggingface, look for other models
86
- filtered_path_map = {k: v for k, v in path_map.items() if k != value}
87
- for k, v in filtered_path_map.items():
88
- if check_huggingface_path(v):
89
- return v
90
- elif check_huggingface_path(lang_domain_path):
91
- return lang_domain_path
92
- elif check_huggingface_path(lang_path):
93
- return lang_path
94
  else:
95
  return "poltextlab/xlm-roberta-large-pooled-cap"
96
 
 
14
  HF_TOKEN = os.environ["hf_read"]
15
 
16
  languages = [
 
 
17
  "English",
18
+ "Multilingual"
 
 
 
 
 
 
 
 
 
19
  ]
20
 
21
  domains = {
 
65
  except (AttributeError, FileNotFoundError):
66
  value = None
67
 
68
+ if language == 'english':
69
+ model_path = lang_path
70
+ else:
71
+ model_path = "poltextlab/xlm-roberta-large-pooled-cap"
72
+
73
+ if check_huggingface_path(model_path):
74
+ return model_path
 
 
 
 
 
 
 
 
75
  else:
76
  return "poltextlab/xlm-roberta-large-pooled-cap"
77