Spaces:
Sleeping
Sleeping
Samantha Hipple
commited on
Commit
•
3bd9cbf
1
Parent(s):
7da31a6
updated cache decorator
Browse files
app.py
CHANGED
@@ -4,13 +4,20 @@ from beluga import load_model, process_emotions, generate_prompt
|
|
4 |
from emodeepface import check_image_rotation, process_photo
|
5 |
|
6 |
# add streamlit cache to prevent multiple reloads of beluga model
|
7 |
-
@st.
|
8 |
def load_cached_model():
|
9 |
return load_model()
|
10 |
|
|
|
|
|
|
|
|
|
11 |
# begin loading beluga model and tokenizer
|
12 |
model, tokenizer = load_cached_model()
|
13 |
|
|
|
|
|
|
|
14 |
# title webpage
|
15 |
st.title("Affective Journaling Assistant")
|
16 |
|
|
|
4 |
from emodeepface import check_image_rotation, process_photo
|
5 |
|
6 |
# add streamlit cache to prevent multiple reloads of beluga model
|
7 |
+
@st.cache_resource
|
8 |
def load_cached_model():
|
9 |
return load_model()
|
10 |
|
11 |
+
# display loading message when app is accessed/refreshed
|
12 |
+
loading_message = st.empty()
|
13 |
+
loading_message.text("Loading model... Please wait.")
|
14 |
+
|
15 |
# begin loading beluga model and tokenizer
|
16 |
model, tokenizer = load_cached_model()
|
17 |
|
18 |
+
# clear loading message
|
19 |
+
loading_message.empty()
|
20 |
+
|
21 |
# title webpage
|
22 |
st.title("Affective Journaling Assistant")
|
23 |
|