kanneboinakumar's picture
Update app.py
ab17647 verified
raw
history blame contribute delete
707 Bytes
import streamlit as st
import numpy as np
from joblib import load
st.title("book recomandation")
model = load("model.pkl")
books_name = load("book_names.pkl")
final_rating = load("final_rating.pkl")
book_pivot_tale = load("book_pivot_tale.pkl")
select_book = st.selectbox("select book",options=books_name)
if st.button("recommend"):
def recommended_book(book_name):
book_id = np.where(book_pivot_tale.index==book_name)[0][0]
distance,suggestion=model.kneighbors(book_pivot_tale.iloc[book_id,:].values.reshape(1,-1),n_neighbors=6)
for i in suggestion:
books = book_pivot_tale.index[i]
return books
st.success(list(recommended_book(select_book)))