Davide Panza commited on
Commit
9bf818a
·
verified ·
1 Parent(s): 52105b7

Update app/main_IO.py

Browse files
Files changed (1) hide show
  1. app/main_IO.py +20 -0
app/main_IO.py CHANGED
@@ -62,6 +62,26 @@ def reset_session_state_on_upload():
62
  st.session_state[key] = default_val
63
 
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  def upload_pdf():
66
  uploaded_file = st.file_uploader("Upload your PDF", type=["pdf"], label_visibility="collapsed")
67
 
 
62
  st.session_state[key] = default_val
63
 
64
 
65
+ # Define model path - check multiple possible locations
66
+ def get_model_path():
67
+ # Try local model first (relative to current script)
68
+ local_model_path = os.path.join(os.path.dirname(__file__), "chromadb_model")
69
+
70
+ # Try app root model folder
71
+ app_model_path = os.path.join(root_path, "models", EMBEDDING_MODEL)
72
+
73
+ # Try current working directory
74
+ cwd_model_path = os.path.join(os.getcwd(), "chromadb_model")
75
+
76
+ # Check which path exists
77
+ for path in [local_model_path, app_model_path, cwd_model_path]:
78
+ if os.path.exists(path):
79
+ return path
80
+
81
+ # If no local model found, return None to download
82
+ return None
83
+
84
+
85
  def upload_pdf():
86
  uploaded_file = st.file_uploader("Upload your PDF", type=["pdf"], label_visibility="collapsed")
87