Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -5,19 +5,19 @@ import streamlit as st
|
|
5 |
from sentence_transformers import SentenceTransformer
|
6 |
from vector_engine.utils import vector_search
|
7 |
|
8 |
-
|
9 |
def read_data(pibdata="pib2022_23_cleaned.csv"):
|
10 |
"""Read the pib data."""
|
11 |
return pd.read_csv(pibdata)
|
12 |
|
13 |
|
14 |
-
|
15 |
def load_bert_model(name="pushpdeep/sbertmsmarco-en_to_indic_ur-murilv1"):
|
16 |
"""Instantiate a sentence-level DistilBERT model."""
|
17 |
return SentenceTransformer(name)
|
18 |
|
19 |
|
20 |
-
|
21 |
def load_faiss_index(path_to_faiss="models/faiss_index_ip.pickle"):
|
22 |
"""Load and deserialize the Faiss index."""
|
23 |
with open(path_to_faiss, "rb") as h:
|
|
|
5 |
from sentence_transformers import SentenceTransformer
|
6 |
from vector_engine.utils import vector_search
|
7 |
|
8 |
+
@st.cache_data
|
9 |
def read_data(pibdata="pib2022_23_cleaned.csv"):
|
10 |
"""Read the pib data."""
|
11 |
return pd.read_csv(pibdata)
|
12 |
|
13 |
|
14 |
+
@st.cache_resource
|
15 |
def load_bert_model(name="pushpdeep/sbertmsmarco-en_to_indic_ur-murilv1"):
|
16 |
"""Instantiate a sentence-level DistilBERT model."""
|
17 |
return SentenceTransformer(name)
|
18 |
|
19 |
|
20 |
+
@st.cache_data
|
21 |
def load_faiss_index(path_to_faiss="models/faiss_index_ip.pickle"):
|
22 |
"""Load and deserialize the Faiss index."""
|
23 |
with open(path_to_faiss, "rb") as h:
|