Spaces:
Running
Running
Update views/rag_med.py
Browse files- views/rag_med.py +10 -6
views/rag_med.py
CHANGED
@@ -37,12 +37,16 @@ with st.sidebar:
|
|
37 |
st.rerun()
|
38 |
|
39 |
# Carregando o índice FAISS e os dados armazenados
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
|
|
46 |
|
47 |
# Inicialize o modelo de embedding
|
48 |
model = SentenceTransformer("all-MiniLM-L6-v2")
|
|
|
37 |
st.rerun()
|
38 |
|
39 |
# Carregando o índice FAISS e os dados armazenados
|
40 |
+
@st.cache_resource
|
41 |
+
def load_faiss_index():
|
42 |
+
index_file = "faiss_index.bin"
|
43 |
+
data_file = "stored_data.pkl"
|
44 |
+
index = faiss.read_index(index_file)
|
45 |
+
with open(data_file, 'rb') as f:
|
46 |
+
stored_data = pickle.load(f)
|
47 |
+
return index, stored_data
|
48 |
+
|
49 |
+
index, stored_data = load_faiss_index()
|
50 |
|
51 |
# Inicialize o modelo de embedding
|
52 |
model = SentenceTransformer("all-MiniLM-L6-v2")
|