shubhendu-ghosh commited on
Commit
7cd5123
1 Parent(s): 054dea0

Upload 6 files

Browse files
Files changed (7) hide show
  1. .gitattributes +1 -0
  2. app.py +111 -0
  3. movie_list.pkl +3 -0
  4. pyvenv.cfg +3 -0
  5. similarity.pkl +3 -0
  6. tmdb_5000_credits.csv +3 -0
  7. tmdb_5000_movies.csv +0 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tmdb_5000_credits.csv filter=lfs diff=lfs merge=lfs -text
app.py ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pickle
3
+ import requests
4
+ import streamlit.components.v1 as components
5
+
6
+
7
+
8
+ def recommend(movie):
9
+ index = movies[movies['title'] == movie].index[0]
10
+ distances = sorted(list(enumerate(similarity[index])),reverse=True,key = lambda x: x[1])
11
+ recommended_movie_names = []
12
+ recommended_movie_posters = []
13
+ for i in distances[1:8]:
14
+ movie_id = movies.iloc[i[0]].movie_id
15
+ recommended_movie_posters.append(fetch_poster(movie_id))
16
+ recommended_movie_names.append(movies.iloc[i[0]].title)
17
+
18
+ return recommended_movie_names,recommended_movie_posters
19
+
20
+
21
+ H = ['Action', 'Adventure', 'Fantasy', 'ScienceFiction', 'Crime', 'Drama', 'Thriller', 'Animation', 'Family', 'Western', 'Comedy', 'Romance', 'Horror',
22
+ 'Mystery', 'History', 'War', 'Music', 'Documentary', 'Foreign', 'TVMovie']
23
+
24
+ def suggest(gen):
25
+ gen = gen.lower()
26
+ url = "https://www.imdb.com/search/title/?genres={}&sort=user_rating,desc".format(gen)
27
+ return url
28
+
29
+
30
+
31
+ def fetch_poster(movie_id):
32
+ url = "https://api.themoviedb.org/3/movie/{}?api_key=8265bd1679663a7ea12ac168da84d2e8&language=en-US".format(movie_id)
33
+ data = requests.get(url)
34
+ data = data.json()
35
+ poster_path = data['poster_path']
36
+ full_path = "https://image.tmdb.org/t/p/w500/" + poster_path
37
+ return full_path
38
+
39
+
40
+
41
+ st.markdown("""<p style="color: #3a02ab;font-size: 70px;font-family: sans-serif;"><b>FILM</b><span style="color: #f75e05;font-size: 70px;font-family: sans-serif;"><b>ISH</b></span></p>""", unsafe_allow_html=True)
42
+
43
+
44
+ movies = pickle.load(open('venv/movie_list.pkl', 'rb'))
45
+ similarity = pickle.load(open('venv/similarity.pkl', 'rb'))
46
+ movie_list = movies['title'].values
47
+
48
+ st.markdown(""" <span style="font-size: 30px; font-family: Arial, Helvetica, sans-serif; color: #040330;"> Enter or select a Movie</span>""", unsafe_allow_html=True)
49
+
50
+ selected_movie = st.selectbox("", movie_list)
51
+ if st.button('Show Recommendation'):
52
+ recommended_movie_names,recommended_movie_posters = recommend(selected_movie)
53
+ col1, col2, col3, col4, col5 , col6, col7 = st.columns(7)
54
+ with col1:
55
+ st.text(recommended_movie_names[0])
56
+ st.image(recommended_movie_posters[0])
57
+ with col2:
58
+ st.text(recommended_movie_names[1])
59
+ st.image(recommended_movie_posters[1])
60
+
61
+ with col3:
62
+ st.text(recommended_movie_names[2])
63
+ st.image(recommended_movie_posters[2])
64
+ with col4:
65
+ st.text(recommended_movie_names[3])
66
+ st.image(recommended_movie_posters[3])
67
+ with col5:
68
+ st.text(recommended_movie_names[4])
69
+ st.image(recommended_movie_posters[4])
70
+ with col6:
71
+ st.text(recommended_movie_names[5])
72
+ st.image(recommended_movie_posters[5])
73
+ with col7:
74
+ st.text(recommended_movie_names[6])
75
+ st.image(recommended_movie_posters[6])
76
+
77
+ components.html("<html> <br /> <br /><br /> </html>")
78
+ components.html(
79
+ """
80
+ <style type="text/css">
81
+ #block {
82
+ height: 100px;
83
+ width: 100%;
84
+ background-color: #f002a5;
85
+ border-radius: 20px;
86
+ position: relative;
87
+ }
88
+ </style>
89
+ <body>
90
+ <br />
91
+ <div id="block">
92
+ <span style="font-size: 42px; color: white; font-family: Arial, Helvetica, sans-serif;"> You will be redirected to IMDB best movies page </span>
93
+ </div>
94
+ </body>
95
+
96
+ """
97
+ )
98
+
99
+ #components.html("<html> <br /> <br /><br /> </html>")
100
+ st.markdown(""" <span style="font-size: 30px; font-family: Arial, Helvetica, sans-serif; color: #040330;"> Enter or select a Genre</span>""", unsafe_allow_html=True)
101
+ selected_genre = st.selectbox("", H)
102
+ if st.button("show movies"):
103
+ link = "[List of movies]("+ suggest(selected_genre)+")"
104
+ st.markdown(link, unsafe_allow_html=True)
105
+
106
+
107
+
108
+
109
+
110
+
111
+
movie_list.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a1e188154bc49b0f4b34544d8f3b80f79349e4eb41e7c45dac192ebc6aa0d663
3
+ size 2396416
pyvenv.cfg ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ home = C:\Users\shubhendu\AppData\Local\Programs\Python\Python38
2
+ include-system-site-packages = false
3
+ version = 3.8.3
similarity.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3fc35f44f2d60dc00bbe3f22bce96715ed374bf2acf74a5f0f6089ab9d10bf1e
3
+ size 184781253
tmdb_5000_credits.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9d0050599ff88d40366c4841204b1489862bca346bfa46c20b05a65d14508435
3
+ size 40044293
tmdb_5000_movies.csv ADDED
The diff for this file is too large to render. See raw diff