Spaces:
Sleeping
Sleeping
Commit
·
5518374
0
Parent(s):
Duplicate from Shahrukh2016/Netflix_Recommender_System
Browse files- .gitattributes +34 -0
- README.md +14 -0
- app.py +73 -0
- content.pkl +3 -0
- content_dict.pkl +3 -0
- cosine_similarity.pkl +3 -0
- recommend.pkl +3 -0
- requirements.txt +0 -0
- teamcolab_netflixmoviesandtvshowsclustering_shahrukh.py +0 -0
- tfidf.pkl +3 -0
- tfidf_matrix.pkl +3 -0
.gitattributes
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Netflix Recommender System
|
3 |
+
emoji: 💻
|
4 |
+
colorFrom: pink
|
5 |
+
colorTo: yellow
|
6 |
+
sdk: streamlit
|
7 |
+
sdk_version: 1.17.0
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
license: other
|
11 |
+
duplicated_from: Shahrukh2016/Netflix_Recommender_System
|
12 |
+
---
|
13 |
+
|
14 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
######################################################
|
2 |
+
# Importing necessary libraries
|
3 |
+
import streamlit as st
|
4 |
+
import pickle
|
5 |
+
import pandas as pd
|
6 |
+
|
7 |
+
#######################################################
|
8 |
+
# Loading the pickle file
|
9 |
+
content_dict= pickle.load(open('content_dict.pkl','rb'))
|
10 |
+
|
11 |
+
# Converting dictionary into pandas DataFrame
|
12 |
+
content= pd.DataFrame(content_dict)
|
13 |
+
|
14 |
+
# Loding the pickle file
|
15 |
+
similarity= pickle.load(open('cosine_similarity.pkl','rb'))
|
16 |
+
|
17 |
+
#######################################################
|
18 |
+
# Defining a function for recommendation system
|
19 |
+
def recommend(title, cosine_sim=similarity, data=content):
|
20 |
+
recommended_content=[]
|
21 |
+
# Get the index of the input title in the programme_list
|
22 |
+
programme_list = data['title'].to_list()
|
23 |
+
index = programme_list.index(title)
|
24 |
+
|
25 |
+
# Create a list of tuples containing the similarity score and index
|
26 |
+
# between the input title and all other programmes in the dataset
|
27 |
+
sim_scores = list(enumerate(cosine_sim[index]))
|
28 |
+
|
29 |
+
# Sort the list of tuples by similarity score in descending order
|
30 |
+
sim_scores = sorted(sim_scores, key=lambda x: x[1], reverse=True)[1:11]
|
31 |
+
|
32 |
+
# Get the recommended movie titles and their similarity scores
|
33 |
+
recommend_index = [i[0] for i in sim_scores]
|
34 |
+
rec_movie = data['title'].iloc[recommend_index]
|
35 |
+
rec_score = [round(i[1], 4) for i in sim_scores]
|
36 |
+
|
37 |
+
# Create a pandas DataFrame to display the recommendations
|
38 |
+
rec_table = pd.DataFrame(list(zip(rec_movie, rec_score)), columns=['Recommendation', 'Similarity_score(0-1)'])
|
39 |
+
# recommended_content.append(rec_table['Recommendation'].values)
|
40 |
+
|
41 |
+
return rec_table['Recommendation'].values
|
42 |
+
|
43 |
+
#######################################################
|
44 |
+
# # Loading the pickle file
|
45 |
+
# content_dict= pickle.load(open('content_dict.pkl','rb'))
|
46 |
+
|
47 |
+
# # Converting dictionary into pandas DataFrame
|
48 |
+
# content= pd.DataFrame(content_dict)
|
49 |
+
|
50 |
+
# # Loding the pickle file
|
51 |
+
# similarity= pickle.load(open('cosine_similarity.pkl','rb'))
|
52 |
+
|
53 |
+
########################################################
|
54 |
+
# Displaying title
|
55 |
+
st.title("Netflix Recommender System")
|
56 |
+
|
57 |
+
# Display dialogue box that contains content
|
58 |
+
selected_content_name = st.selectbox(
|
59 |
+
'Which Movie/TV Show are you watching?',
|
60 |
+
content['title'].values)
|
61 |
+
st.write('**Note**: We have the data till 2019 only.')
|
62 |
+
#########################################################
|
63 |
+
|
64 |
+
# Setting a button
|
65 |
+
if st.button('Recommend'):
|
66 |
+
recommendations= recommend(title=selected_content_name)
|
67 |
+
st.write('**_You are watching:_**', selected_content_name)
|
68 |
+
st.write('**_Your top 10 recommendations:_**')
|
69 |
+
for num,i in enumerate(recommendations):
|
70 |
+
st.write(num+1,':', i)
|
71 |
+
|
72 |
+
# Last note
|
73 |
+
st.write('_Lights out, popcorn in hand, and let the movies begin! We hope our recommendations hit the spot._:smile:')
|
content.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1e366a1e58d083ba23635855fb173d811a8ec30a1c54cd0a581cd52ee0b55cac
|
3 |
+
size 10107932
|
content_dict.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:02c7c712ba520b713b35581143b0fe070710cf39ec225c71adbbce35b1a0dd66
|
3 |
+
size 10312847
|
cosine_similarity.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4d7016172d6a2f870b8cbcdcabd7e75bc58535dc3e3e6cbe24fcca83a835eadb
|
3 |
+
size 482983363
|
recommend.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1212366ceb56df7555e013fd1a567c4dfadd1a8c65059d9ca62438d7cec9f298
|
3 |
+
size 45
|
requirements.txt
ADDED
Binary file (1.69 kB). View file
|
|
teamcolab_netflixmoviesandtvshowsclustering_shahrukh.py
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tfidf.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0397536ca0d45239f9622c039f91e443670e524085c405dfcc535b8764d292b3
|
3 |
+
size 1324438
|
tfidf_matrix.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c99d328016ea1889fc88f3502e7ef9534f673842ad2270efd432057d0ebd26f3
|
3 |
+
size 3424782
|