Upload 8 files
Browse files- .gitignore +1 -0
- app.py +75 -0
- movie-reccommender-system.ipynb +0 -0
- movies_dict.pkl +3 -0
- procfile +1 -0
- requirements.txt +48 -0
- setup.sh +9 -0
- similarity.pkl +3 -0
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
venv
|
app.py
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pandas as pd
|
2 |
+
import streamlit as st
|
3 |
+
import requests
|
4 |
+
|
5 |
+
def fetch_poster(movie_id):
|
6 |
+
url = "https://api.themoviedb.org/3/movie/{}?api_key=8265bd1679663a7ea12ac168da84d2e8&language=en-US".format(
|
7 |
+
movie_id)
|
8 |
+
data = requests.get(url)
|
9 |
+
data = data.json()
|
10 |
+
poster_path = data['poster_path']
|
11 |
+
full_path = "https://image.tmdb.org/t/p/w500/" + poster_path
|
12 |
+
return full_path
|
13 |
+
|
14 |
+
|
15 |
+
import pickle
|
16 |
+
|
17 |
+
|
18 |
+
similarity=pickle.load(open('similarity.pkl','rb'))
|
19 |
+
movies_dict= pickle.load(open('movies_dict.pkl','rb'))
|
20 |
+
movies=pd.DataFrame(movies_dict)
|
21 |
+
st.title('Movie Recommender System ')
|
22 |
+
|
23 |
+
def add_bg_from_url():
|
24 |
+
st.markdown(
|
25 |
+
f"""
|
26 |
+
<style>
|
27 |
+
.stApp {{
|
28 |
+
background-image: url("https://images.pexels.com/photos/2397414/pexels-photo-2397414.jpeg");
|
29 |
+
background-attachment: fixed;
|
30 |
+
background-size: cover
|
31 |
+
}}
|
32 |
+
</style>
|
33 |
+
""",
|
34 |
+
unsafe_allow_html=True
|
35 |
+
)
|
36 |
+
|
37 |
+
add_bg_from_url()
|
38 |
+
def recommend(movie):
|
39 |
+
index = movies[movies['title'] == movie].index[0]
|
40 |
+
distances = sorted(list(enumerate(similarity[index])), reverse=True, key=lambda x: x[1])
|
41 |
+
recommended_movie_names = []
|
42 |
+
recommended_movie_posters = []
|
43 |
+
for i in distances[1:6]:
|
44 |
+
# fetch the movie poster
|
45 |
+
|
46 |
+
movie_id = movies.iloc[i[0]].movie_id
|
47 |
+
recommended_movie_posters.append(fetch_poster(movie_id))
|
48 |
+
recommended_movie_names.append(movies.iloc[i[0]].title)
|
49 |
+
|
50 |
+
return recommended_movie_names,recommended_movie_posters
|
51 |
+
|
52 |
+
|
53 |
+
option = st.selectbox('How would you like to be continued?', movies['title'].values)
|
54 |
+
|
55 |
+
|
56 |
+
if st.button('Recommend') :
|
57 |
+
recommended_movie_names,recommended_movie_posters= recommend(option)
|
58 |
+
|
59 |
+
col1, col2, col3, col4, col5 = st.columns(5)
|
60 |
+
with col1:
|
61 |
+
st.text(recommended_movie_names[0])
|
62 |
+
st.image(recommended_movie_posters[0])
|
63 |
+
with col2:
|
64 |
+
st.text(recommended_movie_names[1])
|
65 |
+
st.image(recommended_movie_posters[1])
|
66 |
+
|
67 |
+
with col3:
|
68 |
+
st.text(recommended_movie_names[2])
|
69 |
+
st.image(recommended_movie_posters[2])
|
70 |
+
with col4:
|
71 |
+
st.text(recommended_movie_names[3])
|
72 |
+
st.image(recommended_movie_posters[3])
|
73 |
+
with col5:
|
74 |
+
st.text(recommended_movie_names[4])
|
75 |
+
st.image(recommended_movie_posters[4])
|
movie-reccommender-system.ipynb
ADDED
The diff for this file is too large to render.
See raw diff
|
|
movies_dict.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4524ee20e02083a5d39d5886066222f0acb9d1c8e9f12cf8f0d3016114e8f070
|
3 |
+
size 2216682
|
procfile
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
web:setup.sh && stramlit run app.py
|
requirements.txt
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
altair==4.2.2
|
2 |
+
attrs==23.1.0
|
3 |
+
blinker==1.6.2
|
4 |
+
cachetools==5.3.0
|
5 |
+
certifi==2023.5.7
|
6 |
+
charset-normalizer==3.1.0
|
7 |
+
click==8.1.3
|
8 |
+
colorama==0.4.6
|
9 |
+
decorator==5.1.1
|
10 |
+
entrypoints==0.4
|
11 |
+
gitdb==4.0.10
|
12 |
+
GitPython==3.1.31
|
13 |
+
idna==3.4
|
14 |
+
importlib-metadata==6.6.0
|
15 |
+
Jinja2==3.1.2
|
16 |
+
jsonschema==4.17.3
|
17 |
+
markdown-it-py==2.2.0
|
18 |
+
MarkupSafe==2.1.2
|
19 |
+
mdurl==0.1.2
|
20 |
+
numpy==1.24.3
|
21 |
+
packaging==23.1
|
22 |
+
pandas==2.0.1
|
23 |
+
Pillow==9.5.0
|
24 |
+
protobuf==3.20.3
|
25 |
+
pyarrow==12.0.0
|
26 |
+
pydeck==0.8.1b0
|
27 |
+
Pygments==2.15.1
|
28 |
+
Pympler==1.0.1
|
29 |
+
pyrsistent==0.19.3
|
30 |
+
python-dateutil==2.8.2
|
31 |
+
pytz==2023.3
|
32 |
+
pytz-deprecation-shim==0.1.0.post0
|
33 |
+
requests==2.30.0
|
34 |
+
rich==13.3.5
|
35 |
+
six==1.16.0
|
36 |
+
smmap==5.0.0
|
37 |
+
streamlit==1.22.0
|
38 |
+
tenacity==8.2.2
|
39 |
+
toml==0.10.2
|
40 |
+
toolz==0.12.0
|
41 |
+
tornado==6.3.1
|
42 |
+
typing_extensions==4.5.0
|
43 |
+
tzdata==2023.3
|
44 |
+
tzlocal==4.3
|
45 |
+
urllib3==2.0.2
|
46 |
+
validators==0.20.0
|
47 |
+
watchdog==3.0.0
|
48 |
+
zipp==3.15.0
|
setup.sh
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
mkdir -p ~/.streamlit/
|
2 |
+
|
3 |
+
echo"\
|
4 |
+
[server]\n\
|
5 |
+
port=$PORT\n\
|
6 |
+
enableCORS=false\n\
|
7 |
+
headLess=true\n\
|
8 |
+
\n\"
|
9 |
+
"> ~/.streamlit/config.toml
|
similarity.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:afe491e2d67528352bb0998b9626f0d67313108f2641028b9a5dd44d47fdb0c7
|
3 |
+
size 184781251
|