Spaces:
Running
Running
Update views/rag_med.py
Browse files- views/rag_med.py +17 -2
views/rag_med.py
CHANGED
@@ -9,8 +9,23 @@ from sentence_transformers import SentenceTransformer
|
|
9 |
import pickle
|
10 |
from prompt_template import prompt
|
11 |
|
12 |
-
#
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
# Initialize the messages list in the session state
|
16 |
if "messages" not in st.session_state:
|
|
|
9 |
import pickle
|
10 |
from prompt_template import prompt
|
11 |
|
12 |
+
# Função para encontrar o arquivo
|
13 |
+
def find_file(filename):
|
14 |
+
current_dir = os.path.dirname(os.path.abspath(__file__))
|
15 |
+
root_dir = os.path.dirname(current_dir)
|
16 |
+
|
17 |
+
possible_paths = [
|
18 |
+
os.path.join(current_dir, filename),
|
19 |
+
os.path.join(root_dir, filename),
|
20 |
+
os.path.join("/content", filename), # Para ambientes como Colab
|
21 |
+
os.path.join("/home/user/app", filename) # Caminho comum no Hugging Face
|
22 |
+
]
|
23 |
+
|
24 |
+
for path in possible_paths:
|
25 |
+
if os.path.exists(path):
|
26 |
+
return path
|
27 |
+
|
28 |
+
raise FileNotFoundError(f"Não foi possível encontrar o arquivo: {filename}")
|
29 |
|
30 |
# Initialize the messages list in the session state
|
31 |
if "messages" not in st.session_state:
|