# streamlit run app.py use for run this web import streamlit as st import pickle import pandas as pd import requests def fechposter(movies_id): response = requests.get(f"https://api.themoviedb.org/3/movie/{movies_id}?api_key=175454cec5e81a00151981dfb22a69d4&language=en-US") data=response.json() # st.write(data) return 'https://image.tmdb.org/t/p/w500/'+data['poster_path'] def recommend(movie): m_index=movies[movies['title']==movie].index[0] distance=similer[m_index] movies_list=sorted(list(enumerate(distance)), reverse=True, key=lambda x : x[1])[1:6] recommended=[] recom_movie_post=[] for m in movies_list: recommended.append(movies.iloc[m[0]].title) recom_movie_post.append(fechposter(movies.iloc[m[0]].movie_id)) return recommended,recom_movie_post movies_l=pickle.load(open('movie_dict.pkl','rb')) similer=pickle.load(open('similer_m.pkl','rb')) movies=pd.DataFrame(movies_l) st.title("w_one_n.cm") selected_movie = st.selectbox( 'Select the movie', movies['title'].values) if st.button('Recommend'): names,posters=recommend(selected_movie) col1,col2,col3,col4,col5 =st.columns(5) with col1: st.text(names[0]) st.image(posters[0]) with col2: st.text(names[1]) st.image(posters[1]) with col3: st.text(names[2]) st.image(posters[2]) with col4: st.text(names[3]) st.image(posters[3]) with col5: st.text(names[4]) st.image(posters[4])