File size: 1,425 Bytes
30e0370 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
import streamlit as st
import pandas as pd
from recommender import load_movie_data, recommend_movies
# Load data
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!")
# Step 1: Mood
mood = st.radio("What's your mood today?", ["Feel-good", "Intense", "Thought-provoking", "Funny"])
# Step 2: Genre
genre = st.selectbox("Pick a genre:", ["Any", "Sci-Fi", "Drama", "Romance", "Action", "Mystery", "Comedy", "Animation", "Thriller"])
# Step 3: Minimum rating
min_rating = st.slider("Minimum IMDb rating:", 1.0, 10.0, 7.0)
# Submit button
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!")
|