import streamlit as st import numpy as np import pandas as pd similarity = np.load("similarity.npy") def recomendMovie(movie_title) : matching_indices = final_movie_df[final_movie_df['title'].str.contains(movie_title, case=False, na=False)].index if not matching_indices.empty: distance = similarity[matching_indices[0]] movie_list = sorted(list(enumerate(distance)), reverse=True, key = lambda x: x[1])[1:6] output = "" for movie in movie_list: output += final_movie_df.iloc[movie[0]].title + "\n" return output else: return "This movie isn't present in the dataset." st.title('Get recommendation related to your favourite movies 🍿 🎬') name = st.text_input("Enter Movie name: ") if name != "": output = recomendMovie(name) st.write(output)