a-menu commited on
Commit
731dce5
1 Parent(s): e396f7a
Files changed (1) hide show
  1. app.py +12 -0
app.py CHANGED
@@ -118,6 +118,8 @@ col1.image(f"{statics}/logo_cnrs.png", width=80)
118
  # ===== SOME FUNCTIONS =====
119
 
120
 
 
 
121
  def download_sentencizer():
122
  """
123
  Downloads the fr_arches_sentencizer model.
@@ -133,6 +135,8 @@ def download_sentencizer():
133
  subprocess.run(["pip", "install", "https://huggingface.co/a-menu/fr_arches_sentencizer/resolve/main/fr_arches_sentencizer-any-py3-none-any.whl"])
134
 
135
 
 
 
136
  def download_ner_trf():
137
  """
138
  Downloads the fr_arches_ner_trf TRF NER model.
@@ -148,6 +152,8 @@ def download_ner_trf():
148
  subprocess.run(["pip", "install", "https://huggingface.co/a-menu/fr_arches_ner_trf/resolve/main/fr_arches_ner_trf-any-py3-none-any.whl"])
149
 
150
 
 
 
151
  def download_ner():
152
  """
153
  Downloads the fr_arches_ner NER model.
@@ -163,6 +169,8 @@ def download_ner():
163
  subprocess.run(["pip", "install", "https://huggingface.co/a-menu/fr_arches_ner/resolve/main/fr_arches_ner-any-py3-none-any.whl"])
164
 
165
 
 
 
166
  def load_sentencizer():
167
  """
168
  Loads our custom sentence segmentation model.
@@ -175,6 +183,8 @@ def load_sentencizer():
175
  return senter
176
 
177
 
 
 
178
  def load_ner_trf():
179
  """
180
  Loads our custom fr_arches_ner_trf trf ner model.
@@ -190,6 +200,8 @@ def load_ner_trf():
190
  return ner
191
 
192
 
 
 
193
  def load_ner():
194
  """
195
  Loads our custom fr_arches_ner ner model.
 
118
  # ===== SOME FUNCTIONS =====
119
 
120
 
121
+ # Cached to prevent computation on every rerun
122
+ @st.cache_resource
123
  def download_sentencizer():
124
  """
125
  Downloads the fr_arches_sentencizer model.
 
135
  subprocess.run(["pip", "install", "https://huggingface.co/a-menu/fr_arches_sentencizer/resolve/main/fr_arches_sentencizer-any-py3-none-any.whl"])
136
 
137
 
138
+ # Cached to prevent computation on every rerun
139
+ @st.cache_resource
140
  def download_ner_trf():
141
  """
142
  Downloads the fr_arches_ner_trf TRF NER model.
 
152
  subprocess.run(["pip", "install", "https://huggingface.co/a-menu/fr_arches_ner_trf/resolve/main/fr_arches_ner_trf-any-py3-none-any.whl"])
153
 
154
 
155
+ # Cached to prevent computation on every rerun
156
+ @st.cache_resource
157
  def download_ner():
158
  """
159
  Downloads the fr_arches_ner NER model.
 
169
  subprocess.run(["pip", "install", "https://huggingface.co/a-menu/fr_arches_ner/resolve/main/fr_arches_ner-any-py3-none-any.whl"])
170
 
171
 
172
+ # Cached to prevent computation on every rerun
173
+ @st.cache_resource
174
  def load_sentencizer():
175
  """
176
  Loads our custom sentence segmentation model.
 
183
  return senter
184
 
185
 
186
+ # Cached to prevent computation on every rerun
187
+ @st.cache_resource
188
  def load_ner_trf():
189
  """
190
  Loads our custom fr_arches_ner_trf trf ner model.
 
200
  return ner
201
 
202
 
203
+ # Cached to prevent computation on every rerun
204
+ @st.cache_resource
205
  def load_ner():
206
  """
207
  Loads our custom fr_arches_ner ner model.