| | import streamlit as st
|
| | import pandas as pd
|
| | from recommender import load_movie_data, recommend_movies
|
| |
|
| |
|
| | df = load_movie_data()
|
| |
|
| | st.set_page_config(page_title="Movie Chatbot", layout="centered")
|
| | st.title("π¬ Movie Recommender Chatbot")
|
| | st.write("Answer a few quick questions and get personalized movie suggestions!")
|
| |
|
| |
|
| | mood = st.radio("What's your mood today?", ["Feel-good", "Intense", "Thought-provoking", "Funny"])
|
| |
|
| |
|
| | genre = st.selectbox("Pick a genre:", ["Any", "Sci-Fi", "Drama", "Romance", "Action", "Mystery", "Comedy", "Animation", "Thriller"])
|
| |
|
| |
|
| | min_rating = st.slider("Minimum IMDb rating:", 1.0, 10.0, 7.0)
|
| |
|
| |
|
| | if st.button("π₯ Recommend Movies"):
|
| | st.write("Here are some movies you might like:")
|
| |
|
| | results = recommend_movies(
|
| | df,
|
| | mood=None if mood == "Any" else mood,
|
| | genre=None if genre == "Any" else genre,
|
| | min_rating=min_rating
|
| | )
|
| |
|
| | if not results.empty:
|
| | for _, row in results.iterrows():
|
| | if pd.notna(row["poster"]):
|
| | st.image(row["poster"], width=200)
|
| |
|
| | st.markdown(f"**π¬ {row['title']}** ({row['year']}) β *{row['genre']}*")
|
| | st.write(f"β {row['rating']}")
|
| | st.markdown("---")
|
| | else:
|
| | st.warning("No movies matched your filters. Try relaxing the criteria!")
|
| |
|