Skip to content

Instantly share code, notes, and snippets.

@vaibhavgehani
Created July 19, 2020 05:05
Show Gist options
  • Save vaibhavgehani/1bad0c7e852315945b905e605058780f to your computer and use it in GitHub Desktop.
Save vaibhavgehani/1bad0c7e852315945b905e605058780f to your computer and use it in GitHub Desktop.
def recommend_movie(movieName,cosine_sim=cosine_sim):
try:
indx=indices[movieName]
score_tuple=list(enumerate(cosine_sim[indx]))
sorted_tuple=sorted(score_tuple,key=lambda x: x[1],reverse=True)
top_10_score=sorted_tuple[1:6]
top_10_index=[i[0] for i in top_10_score]
return movie_data[['title','spoken_languages','popularity','release_date','runtime','poster_path']].iloc[top_10_index]
except(Exception):
print('Erorr')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment