Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +23 -0
src/streamlit_app.py
CHANGED
|
@@ -244,6 +244,29 @@ elif page:
|
|
| 244 |
with col2:
|
| 245 |
if st.button("Didn't Watch"):
|
| 246 |
st.rerun()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
else:
|
| 248 |
st.title("Welcome to Movie Recommender")
|
| 249 |
st.write("Use the navigation above to explore.")
|
|
|
|
| 244 |
with col2:
|
| 245 |
if st.button("Didn't Watch"):
|
| 246 |
st.rerun()
|
| 247 |
+
elif search_query:
|
| 248 |
+
st.title(f"Search Results for '{search_query}'")
|
| 249 |
+
filtered = movie_df[movie_df["clean_title"].str.contains(search_query, case=False, na=False)]
|
| 250 |
+
if filtered.empty:
|
| 251 |
+
st.warning("No movies found.")
|
| 252 |
+
else:
|
| 253 |
+
for _, movie in filtered.iterrows():
|
| 254 |
+
col1, col2 = st.columns([1, 3])
|
| 255 |
+
with col1:
|
| 256 |
+
poster_url, _ = get_tmdb_data(movie["clean_title"], movie["year"])
|
| 257 |
+
if poster_url and "placeholder.com" not in poster_url:
|
| 258 |
+
st.image(poster_url, width=150)
|
| 259 |
+
else:
|
| 260 |
+
st.markdown("""
|
| 261 |
+
<div style='width:150px;border:2px dashed gray;height:225px;display:flex;align-items:center;justify-content:center;color:gray;'>
|
| 262 |
+
No picture available
|
| 263 |
+
</div>
|
| 264 |
+
""", unsafe_allow_html=True)
|
| 265 |
+
with col2:
|
| 266 |
+
st.subheader(movie["clean_title"])
|
| 267 |
+
st.write(f"Genres: {movie['genres']}")
|
| 268 |
+
st.write(f"Year: {movie['year']}")
|
| 269 |
+
st.markdown(f"[🔍 Details](/?movie_id={movie['movieId']})", unsafe_allow_html=True)
|
| 270 |
else:
|
| 271 |
st.title("Welcome to Movie Recommender")
|
| 272 |
st.write("Use the navigation above to explore.")
|