import streamlit as st
import numpy as np
import pickle
popular_df = pickle.load(open("popular_df.pkl", "rb"))
books = pickle.load(open("books.pkl", "rb"))
similarity_scores = pickle.load(open("similarity_scores.pkl", "rb"))
pt_table = pickle.load(open("pt_table.pkl", "rb"))
# st.sidebar.header("BooK RecommendeR SysteM")
st.sidebar.markdown('
This is a Book Recommender System that features a homepage with the Top 50 highly-rated books,
along with personalized book recommendations based on your preferences. Additionally,
explore a curated selection of the best machine learning and deep learning books."""
st.sidebar.write("")
# sidebar_text = """This is a Book Recommender System that features a homepage with the Top 50 highly-rated
# books and a second tab for personalized book recommendations based on your preferences."""
st.sidebar.markdown(f'{paragraph_text}
', unsafe_allow_html=True)
st.sidebar.write("")
st.sidebar.image("https://images.amazon.com/images/P/0151008116.01.LZZZZZZZ.jpg")
st.sidebar.image("https://images.amazon.com/images/P/0385504209.01.LZZZZZZZ.jpg")
st.sidebar.image("https://images.amazon.com/images/P/0439064872.01.LZZZZZZZ.jpg")
st.sidebar.image("https://images.amazon.com/images/P/0142001740.01.LZZZZZZZ.jpg")
custom_css = ("""
""")
st.markdown(custom_css, unsafe_allow_html=True)
tab1, tab2, tab3, tab4, tab5 = st.tabs(["Home", "Book Recommender","ML/DL Books", "Info", "Contact"])
book_name = popular_df["Book-Title"]
author = popular_df["Book-Author"]
image = popular_df["Image-URL-L"]
votes = popular_df["rating_num"]
rating = popular_df["avg_rating"]
with tab1:
st.markdown('Top 50 best rated Books
',
unsafe_allow_html=True)
# st.markdown("
", unsafe_allow_html=True)
# st.header("Top 50 Books")
col1, col2, col3 = st.columns(3)
columns = [col1, col2, col3]
for idx, (item1, item2, item3, item4, item5) in enumerate(zip(image, book_name, author, votes, rating)):
with columns[idx % 3]: # Cycle through columns
# with st.container():
# st.image(item1, width=200)
st.markdown(
f"",
unsafe_allow_html=True)
# st.header(item2)
st.markdown(f"{item2}
", unsafe_allow_html=True)
st.markdown(f"{item3}
", unsafe_allow_html=True)
#st.subheader(item3)
st.markdown(
f""
f"
Votes: {item4}
"
f"
Rating: {np.round(item5, 1)}
"
f"
",
unsafe_allow_html=True)
# st.write("Votes: ", item4)
# st.write("Rating: ", np.round(item5,1))
st.divider()
with tab2:
# st.header("Books Recommender")
st.markdown('Books Recommender
',
unsafe_allow_html=True)
st.write("")
# book_name = str(st.text_area("Enter your book name here:", key="textarea", placeholder="Book Name...", height=50))
# st.write(type(book_name))
def books_recommed(book_name):
# fecth_index
index = np.where(pt_table.index == book_name)[0][0]
# fecth_selected_items
selected_items = sorted(list(enumerate(similarity_scores[index])), key=lambda x:x[1], reverse=True)[1:7]
data = []
for i in selected_items:
items = []
temp_df = books[books["Book-Title"] == pt_table.index[i[0]]]
items.extend(list(temp_df.drop_duplicates("Book-Title")["Book-Title"].values))
items.extend(list(temp_df.drop_duplicates("Book-Title")["Book-Author"].values))
items.extend(list(temp_df.drop_duplicates("Book-Title")["Image-URL-L"].values))
data.append(items)
# print(data)
return data
# book_name = str(st.text_area("Enter your book name here:", key="textarea", placeholder="Book Name...", height=50))
book_name = st.text_input("Enter the book name", placeholder="Enter here...")
if st.button("Check Books (double click)"):
message_placeholder = st.empty()
try:
message_placeholder.markdown(f'Recommended Books to Read
',
unsafe_allow_html=True)
st.write("")
thing1 = books_recommed(book_name)
# thing1 = "1984"
col1, col2, col3 = st.columns(3)
# st.image(thing3)
columns = [col1, col2, col3]
# Display books in the columns
for idx, (title, author, image_url) in enumerate(thing1):
with columns[idx % 3]:
st.markdown(f"", unsafe_allow_html=True)
st.markdown(f"{title}
", unsafe_allow_html=True)
st.markdown(f"{author}
", unsafe_allow_html=True)
st.divider()
except Exception as e:
message_placeholder.markdown(f'Enter correct book name
',
unsafe_allow_html=True)
st.error(f"Error: {e}")
with tab3:
st.markdown('Best ML/DL Books
',
unsafe_allow_html=True)
# st.title("Best Books for Machine Learning")
st.write("")
st.markdown('Best Books for Machine Learning and Deep learning
',
unsafe_allow_html=True)
st.write("")
col1, col2, col3 = st.columns(3)
image = "image3.jpg"
image2 = "https://github.com/ajstyle007/books/blob/main/deep_learning_from_scratch.jpg?raw=true"
image3 = "https://github.com/ajstyle007/books/blob/main/hands_on_machine_learning.jpg?raw=true"
image4 = "https://github.com/ajstyle007/books/blob/main/designing_machine_learning_systems.jpg?raw=true"
image5 = "https://github.com/ajstyle007/books/blob/main/deep_learning_for_coders.jpg?raw=true"
image6 = "https://github.com/ajstyle007/books/blob/main/deep_learning_goodfellow.jpg?raw=true"
image7 = "https://github.com/ajstyle007/books/blob/main/deep_learning_with_python.jpg?raw=true"
image8 = "https://github.com/ajstyle007/books/blob/main/grokking_deep_learning.jpg?raw=true"
image9 = "https://github.com/ajstyle007/books/blob/main/npl_with_transformers.jpg?raw=true"
image10 = "https://github.com/ajstyle007/books/blob/main/practical_deep_learning_for_cloud.jpg?raw=true"
image11 = "https://github.com/ajstyle007/books/blob/main/the_100_page_ml_book.jpg?raw=true"
image12 = "https://github.com/ajstyle007/books/blob/main/elements_of_statistical_learning.jpg?raw=true"
image13 = "https://github.com/ajstyle007/books/blob/main/intro_ml_R.jpg?raw=true"
image14 = "https://github.com/ajstyle007/books/blob/main/mathematics.jpg?raw=true"
image15 = "https://github.com/ajstyle007/books/blob/main/nn_deep_learning.jpg?raw=true"
with col1:
# st.image("image3.jpg", width=200)
# first book
st.markdown(f"",unsafe_allow_html=True)
st.markdown('Deep Learning from Scratch
',
unsafe_allow_html=True)
st.markdown('Seth Weidman
',
unsafe_allow_html=True)
st.divider()
# second book
st.markdown(f"",unsafe_allow_html=True)
st.markdown('Deep Learning for Coders with fastai and PyTorch
',
unsafe_allow_html=True)
st.markdown('Jeremy Howard and Sylvain Gugger
',
unsafe_allow_html=True)
st.divider()
# third book
st.markdown(f"",unsafe_allow_html=True)
st.markdown('Grokking Deep Learning
',
unsafe_allow_html=True)
st.markdown('Andrew W. Trask
',
unsafe_allow_html=True)
st.divider()
# fourth book
st.markdown(f"",unsafe_allow_html=True)
st.markdown('The Hundred-page Machine Learning Book
',
unsafe_allow_html=True)
st.markdown('Andriy Burkov
',
unsafe_allow_html=True)
st.divider()
# fourth book
st.markdown(f"",unsafe_allow_html=True)
st.markdown('mathematics
',
unsafe_allow_html=True)
st.markdown('ncert
',
unsafe_allow_html=True)
with col2:
# st.image("image3.jpg", width=200)
# 5th book
st.markdown(f"",unsafe_allow_html=True)
st.markdown('Hand-On Machine Learning with Scikit-Learn, Keras and TensorFlow
',
unsafe_allow_html=True)
st.markdown('Aurellen Geron
',
unsafe_allow_html=True)
st.divider()
# 6th book
st.markdown(f"",unsafe_allow_html=True)
st.markdown('Deep Learning
',
unsafe_allow_html=True)
st.markdown('Aaron Courville, Ian Goodfellow, and Yoshua Bengio
',
unsafe_allow_html=True)
st.divider()
# 7th book
st.markdown(f"",unsafe_allow_html=True)
st.markdown('Natural Language Processing with Transformers
',
unsafe_allow_html=True)
st.markdown('Leandro von Werra, Lewis Tunstall, and Thomas Wolf
',
unsafe_allow_html=True)
st.divider()
# 8th book
st.markdown(f"",unsafe_allow_html=True)
st.markdown('The Elements of Statistical Learning
',
unsafe_allow_html=True)
st.markdown('Jerome H. Friedman, Robert Tibshirani, and Trevor Hastie
',
unsafe_allow_html=True)
with col3:
# st.image("image3.jpg", width=200)
# 9th book
st.markdown(f"",unsafe_allow_html=True)
st.markdown('Designing Machine Learning Systems
',
unsafe_allow_html=True)
st.markdown('Chip Huyen
',
unsafe_allow_html=True)
st.divider()
# 10th book
st.markdown(f"",unsafe_allow_html=True)
st.markdown('Deep Learning with Python
',
unsafe_allow_html=True)
st.markdown('François Chollet
',
unsafe_allow_html=True)
st.divider()
# 11th book
st.markdown(f"",unsafe_allow_html=True)
st.markdown('Practical Deep Learning for Cloud, Mobile, & Edge
',
unsafe_allow_html=True)
st.markdown('Anirudh Koul, Meher Kasam, and Siddha Ganju
',
unsafe_allow_html=True)
st.divider()
# 12th book
st.markdown(f"",unsafe_allow_html=True)
st.markdown('An Introduction to Statistical Learning
',
unsafe_allow_html=True)
st.markdown('Gareth M. James, Trevor Hastie, Daniela Witten, & Robert Tibshirani
',
unsafe_allow_html=True)
st.divider()
# fourth book
st.markdown(f"",unsafe_allow_html=True)
st.markdown('Neural Network and Deep Learning
',
unsafe_allow_html=True)
st.markdown('Michael Nielsen
',
unsafe_allow_html=True)
with tab4:
st.markdown('why you should read books
',
unsafe_allow_html=True)
# st.subheader("why you should read books")
st.write("")
st.write("")
st.write("")
st.markdown("""
""", unsafe_allow_html=True)
text1 = """
Reading books is one of the most valuable habits you can develop. Books broaden your perspective, offering a window into
different cultures, ideas, and eras. They stimulate your mind, improve focus, and build critical thinking skills.
Reading regularly enhances your vocabulary, strengthens your ability to articulate thoughts, and fuels creativity.
It can reduce stress by providing a healthy escape from daily pressures and help you understand yourself and others more deeply."""
# Adjusted paragraph text
text2 = """Books also offer lifelong learning opportunities, allowing you to continuously grow intellectually and emotionally.
Whether fiction or non-fiction, every book has the potential to shape your outlook and inspire new ways of thinking."""
# Display the paragraph in a custom box
st.markdown(f'{text1}
', unsafe_allow_html=True)
st.write("")
st.markdown(f'{text2}
', unsafe_allow_html=True)
with tab5:
st.markdown('Contact Me
',
unsafe_allow_html=True)
st.write("")
st.write("")
col1, col2, col3,col4 = st.columns(4)
with col2:
st.write("")
st.write("")
st.write("")
email = "kumarajaypaonta.@gmail.com"
email_image = "https://github.com/ajstyle007/images/blob/main/email.png?raw=true"
linkedin = "https://www.linkedin.com/in/ajay-kumar-72ba861b8/"
linkedin_image = "https://github.com/ajstyle007/images/blob/main/linkedin.png?raw=true"
medium = "https://medium.com/@kumarajaypaonta"
medium_image = "https://github.com/ajstyle007/images/blob/main/medium.jpg?raw=true"
st.markdown(f'''
''', unsafe_allow_html=True)
st.write("")
st.markdown(f'''
''', unsafe_allow_html=True)
with col3:
# st.image("image3.jpg", width=150)
# st.markdown('Medium Blogs
',
# unsafe_allow_html=True)
st.write("")
st.markdown(f'''''', unsafe_allow_html=True)
# st.subheader("Email")
# st.write("kumarajaypaonta.@gmail.com")
# st.subheader("LinkedIn")
# st.write("https://www.linkedin.com/in/ajay-kumar-72ba861b8/")