bokey commited on
Commit
104b9b1
1 Parent(s): 12033a4

models dir was not accessible

Browse files
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -16,12 +16,6 @@ import datetime
16
  from transformers import AutoTokenizer, T5ForConditionalGeneration
17
  from spacy import displacy
18
 
19
- ## Load spaCy models from saved_models directory
20
-
21
- # Get absolute path to the current script's directory
22
- script_dir = os.path.dirname(os.path.abspath(__file__))
23
- saved_models_dir = os.path.join(script_dir, "saved_models")
24
- nlp_models = ["en_core_web_sm", "en_core_web_md", "en_core_web_lg"] + [os.path.join(saved_models_dir, str(model_name)) for model_name in os.listdir(saved_models_dir)]
25
 
26
  # fuction to load the csv file and extract sentences and tags
27
  def load_data_from_csv(file):
@@ -36,7 +30,7 @@ def load_data_from_csv(file):
36
 
37
 
38
  # Streamlit UI for Online Inference
39
- def online_inference():
40
  st.title("Online Inference")
41
 
42
  selected_model = st.selectbox("Select base Model for finetunning", nlp_models)
@@ -316,10 +310,15 @@ def ensure_folders_exist(script_dir):
316
 
317
  def main():
318
 
319
- script_dir = os.path.dirname(os.path.abspath(__file__))
320
 
 
 
321
  # Ensure that required folders exist
322
  ensure_folders_exist(script_dir)
 
 
 
323
 
324
  # Streamlit App
325
  st.set_page_config(page_title="NER Model Experimentation")
@@ -330,7 +329,7 @@ def main():
330
  "GEN AI"])
331
 
332
  if page == "Online Inference":
333
- online_inference()
334
  elif page == "Model Training":
335
  model_training()
336
  elif page == "GEN AI":
 
16
  from transformers import AutoTokenizer, T5ForConditionalGeneration
17
  from spacy import displacy
18
 
 
 
 
 
 
 
19
 
20
  # fuction to load the csv file and extract sentences and tags
21
  def load_data_from_csv(file):
 
30
 
31
 
32
  # Streamlit UI for Online Inference
33
+ def online_inference(nlp_models):
34
  st.title("Online Inference")
35
 
36
  selected_model = st.selectbox("Select base Model for finetunning", nlp_models)
 
310
 
311
  def main():
312
 
313
+ ## Load spaCy models from saved_models directory
314
 
315
+ # Get absolute path to the current script's directory
316
+ script_dir = os.path.dirname(os.path.abspath(__file__))
317
  # Ensure that required folders exist
318
  ensure_folders_exist(script_dir)
319
+ saved_models_dir = os.path.join(script_dir, "saved_models")
320
+ nlp_models = ["en_core_web_sm", "en_core_web_md", "en_core_web_lg"] + [os.path.join(saved_models_dir, str(model_name)) for model_name in os.listdir(saved_models_dir)]
321
+
322
 
323
  # Streamlit App
324
  st.set_page_config(page_title="NER Model Experimentation")
 
329
  "GEN AI"])
330
 
331
  if page == "Online Inference":
332
+ online_inference(nlp_models)
333
  elif page == "Model Training":
334
  model_training()
335
  elif page == "GEN AI":