If you post some code, there's a chance somebody who is familiar with what you're are doing can help but this forum is not usually a place where you'll get much programming help. You should head over to Stack Overflow or somewhere similar if that's what you're looking for.
import streamlit as st
import pickle
import pandas as pd
import requests
# def fetch_poster(movie_id):
# requests.get('')
def recommend(movie):
movie_index = movies[movies['title'] == movie].index[0]
distances = similarity[movie_index]
movies_list = sorted(list(enumerate(distances)), reverse=True, key=lambda x: x[1])[1:6]
recommended_movies = []
recommended_movies_posters = []
for i in movies_list:
movie_id = i[0]
#fetching the poster from api
recommended_movies.append(movies.iloc[i[0]].title)
# recommended_movies_posters.append(fetch_poster(movie_id))
return recommended_movies
movie_dict = pickle.load(open('movie_dict.pkl','rb'))
movies = pd.DataFrame(movie_dict)
similarity = pickle.load(open('similarity.pkl','rb'))
st.title('Movie Recommender System')
selected_movie_name = st.selectbox(
'How would you like to be contacted?',
movies['title'].values)
if st.button('Recommend'):
recommendations = recommend(selected_movie_name)
for i in recommendations:
st.write(i)
I want to add the posters in this code so please you give me the API key for supporting this code .
Travis Bell 的回复
于 2024 年 12 月 17 日 11:08上午
Hi @visha65456,
If you post some code, there's a chance somebody who is familiar with what you're are doing can help but this forum is not usually a place where you'll get much programming help. You should head over to Stack Overflow or somewhere similar if that's what you're looking for.
Ayu_D 的回复
于 2024 年 12 月 22 日 11:35上午
I want to add the posters in this code so please you give me the API key for supporting this code .