|
import recomender |
|
import streamlit as st |
|
import requests |
|
import pandas as pd |
|
|
|
|
|
|
|
df_cbf_Q = pd.read_csv('df_cbf_Q.csv', low_memory = False) |
|
list_of_all_movies = list(df_cbf_Q['original_title']) |
|
|
|
def get_movie_information(movie_title): |
|
params={"apikey": "c176e26f", "t": movie_title, "plot": "full"} |
|
response = requests.get("http://www.omdbapi.com/", params=params) |
|
|
|
if response.status_code == 200: |
|
data = response.json() |
|
|
|
if data["Response"] == "False": |
|
print(data["Error"]) |
|
else: |
|
return data |
|
else: |
|
print("Error:", response.status_code) |
|
|
|
|
|
|
|
|
|
|
|
def show_image(index): |
|
dict_movie =get_movie_information(list_of_movies[index]) |
|
st.header(dict_movie["Title"]) |
|
st.subheader(dict_movie["Year"]) |
|
if dict_movie["Poster"] != "N/A": |
|
st.image(dict_movie["Poster"], use_column_width=False) |
|
else: |
|
st.write("Poster is not available!") |
|
|
|
st.markdown(f"**IMDB Rating:** {dict_movie['imdbRating']} / 10") |
|
st.markdown(f"**Director:** {dict_movie['Director']}") |
|
st.markdown(f"**Actors:** {dict_movie['Actors']}") |
|
st.markdown(f"**Writer:** {dict_movie['Writer']}") |
|
st.markdown(f"**Genre:** {dict_movie['Genre']}") |
|
st.markdown(f"**Year:** {dict_movie['Year']}") |
|
st.markdown(f"**Country:** {dict_movie['Country']}") |
|
st.markdown(f"**Language:** {dict_movie['Language']}") |
|
st.write(f"**Plot:** {dict_movie['Plot']}") |
|
|
|
|
|
|
|
|
|
|
|
|
|
st.set_page_config(page_title="Movie Info", page_icon=":movie_camera:") |
|
st.title("Movie Recommender Engine") |
|
|
|
system_option = st.radio(" How would you like us to choose your next movie?" |
|
,("Best Movies of all time","Trend Movies","Special for You:)", " People with similar tast like (CFR)")) |
|
|
|
movies_watched = st.multiselect("What are your top three fovorite movies? (At least 3 movies)", list_of_all_movies) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
suggest_button = st.button("Suggests me new movies to watch! ") |
|
|
|
if suggest_button: |
|
if len(movies_watched) < 3: |
|
st.error(" You need to mention 3 movies!") |
|
|
|
else: |
|
if system_option == "Best Movies of all time": |
|
list_of_movies = recomender.final_recommender_hot_picks_of_all_time(movies_watched) |
|
|
|
elif system_option == "Trend Movies": |
|
list_of_movies = recomender.final_recommender_hot_picks_now(movies_watched) |
|
|
|
elif system_option == "Trend Movies","Special for You:)": |
|
list_of_movies = recomender.final_recommender_for_you(movies_watched) |
|
|
|
else: |
|
list_of_movies = recomender.recommender_svd(movies_watched) |
|
|
|
for i,_ in enumerate(list_of_movies): |
|
show_image(i) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|