Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -25,6 +25,18 @@ COLLECTION_NAME = "spotify_songs"
|
|
25 |
|
26 |
st.set_page_config(page_title="Spotify Similarity Search", page_icon="🎵", layout="wide")
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
@st.cache_resource
|
29 |
def load_resources():
|
30 |
return AudioEncoder()
|
@@ -260,6 +272,8 @@ def main():
|
|
260 |
|
261 |
st.title("Spotify Similarity Search")
|
262 |
|
|
|
|
|
263 |
|
264 |
qdrant_client = get_qdrant_client()
|
265 |
|
|
|
25 |
|
26 |
st.set_page_config(page_title="Spotify Similarity Search", page_icon="🎵", layout="wide")
|
27 |
|
28 |
+
def reset_environment():
|
29 |
+
# Clear all st.cache_resource and st.cache_data
|
30 |
+
st.cache_resource.clear()
|
31 |
+
st.cache_data.clear()
|
32 |
+
|
33 |
+
# Clear all items in session state
|
34 |
+
for key in list(st.session_state.keys()):
|
35 |
+
del st.session_state[key]
|
36 |
+
|
37 |
+
# Generate a new session ID
|
38 |
+
st.session_state.session_id = str(uuid.uuid4())
|
39 |
+
|
40 |
@st.cache_resource
|
41 |
def load_resources():
|
42 |
return AudioEncoder()
|
|
|
272 |
|
273 |
st.title("Spotify Similarity Search")
|
274 |
|
275 |
+
if 'session_id' not in st.session_state:
|
276 |
+
reset_environment()
|
277 |
|
278 |
qdrant_client = get_qdrant_client()
|
279 |
|