poltextlab commited on
Commit
aa99e35
·
verified ·
1 Parent(s): 6d5bc37

add is disk full check

Browse files
Files changed (1) hide show
  1. interfaces/ontolisst.py +7 -0
interfaces/ontolisst.py CHANGED
@@ -15,6 +15,8 @@ languages = [
15
 
16
  from label_dicts import ONTOLISST_LABEL_NAMES
17
 
 
 
18
  # --- DEBUG ---
19
  import shutil
20
 
@@ -79,6 +81,11 @@ def predict(text, model_id, tokenizer_id):
79
  def predict_cap(text, language):
80
  model_id = build_huggingface_path(language)
81
  tokenizer_id = "xlm-roberta-large"
 
 
 
 
 
82
  return predict(text, model_id, tokenizer_id)
83
 
84
  demo = gr.Interface(
 
15
 
16
  from label_dicts import ONTOLISST_LABEL_NAMES
17
 
18
+ from utils import is_disk_full
19
+
20
  # --- DEBUG ---
21
  import shutil
22
 
 
81
  def predict_cap(text, language):
82
  model_id = build_huggingface_path(language)
83
  tokenizer_id = "xlm-roberta-large"
84
+
85
+ if is_disk_full():
86
+ os.system('rm -rf /data/models*')
87
+ os.system('rm -r ~/.cache/huggingface/hub')
88
+
89
  return predict(text, model_id, tokenizer_id)
90
 
91
  demo = gr.Interface(