Spaces:
Runtime error
Runtime error
Juan Martínez
commited on
Commit
·
c920449
1
Parent(s):
7ecf31e
no cache for model
Browse files
app.py
CHANGED
@@ -18,17 +18,17 @@ def get_dataset():
|
|
18 |
|
19 |
@st.cache()
|
20 |
def get_model():
|
21 |
-
model
|
22 |
-
|
23 |
|
24 |
ds = get_dataset()
|
25 |
-
|
26 |
|
27 |
st.markdown("# Buscador de Noticias Salvadoreñas")
|
28 |
search_text = st.text_input(label="Búsqueda")
|
29 |
|
30 |
if search_text:
|
31 |
-
search_results = search(search_text, model, ds, 10)
|
32 |
for title, content, url, _ in search_results:
|
33 |
st.markdown(f"""<div><a href="{url}">{title}</a></div>""", unsafe_allow_html=True)
|
34 |
st.markdown(f"""<div>{content}...</div>""", unsafe_allow_html=True)
|
|
|
18 |
|
19 |
@st.cache()
|
20 |
def get_model():
|
21 |
+
if "model" not in st.session_state:
|
22 |
+
st.session_state["model"] = SentenceTransformer("justinian336/chupeto")
|
23 |
|
24 |
ds = get_dataset()
|
25 |
+
get_model()
|
26 |
|
27 |
st.markdown("# Buscador de Noticias Salvadoreñas")
|
28 |
search_text = st.text_input(label="Búsqueda")
|
29 |
|
30 |
if search_text:
|
31 |
+
search_results = search(search_text, st.session_state["model"], ds, 10)
|
32 |
for title, content, url, _ in search_results:
|
33 |
st.markdown(f"""<div><a href="{url}">{title}</a></div>""", unsafe_allow_html=True)
|
34 |
st.markdown(f"""<div>{content}...</div>""", unsafe_allow_html=True)
|