Skip to content
This repository has been archived by the owner on Nov 23, 2023. It is now read-only.

Streamlit #69

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Moviepic
Binary file not shown.
18,416 changes: 18,416 additions & 0 deletions The_Movie_Recommender.ipynb

Large diffs are not rendered by default.

Binary file added resources/imgs/download.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/imgs/download2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions streamlit_app/1_general_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Streamlit dependencies
import streamlit as st

# Data dependencies
import numpy as np
import pandas as pd
import PIL
from PIL import Image

def main():
img = Image.open('Kmeans.PNG')
img1 = img.resize((2000,300))
col1, col2, col3 = st.columns(3)
with col1:
st.text("")
with col2:
st.image(img1, caption=None, use_column_width=True)
with col3:
st.text("")
st.subheader("KMeans Movie Recommender")
st.markdown("Kmeans movie recommender is a web app that recommend movies to its users. In this system, users are asked to rate movies they just finished seeing and the ratings are used to recommend other movies to them.")
img2 = Image.open('Moviepic')
st.image(img2, caption=None)

st.markdown("This app is built towards increasing users satisfaction of streaming apps by identifying movies users love through their ratings and recommending similar movies to them. In the same vein, the app identify movies users do not like and make sure similar movies to that are not recommended to such users. The recommendations take diffferent forms such as email notifications, in app notifications or making the recommended movies appear on the frontpage of the user's account.")
st.markdown("As a way of showing the power of this app to our potential partners, we have provided an interface that allows people to select movies and get lists of movies similar to what they have selected.")
st.subheader("Using The Kmeans Recommender")
st.markdown("Go to the KMeans Recommender page. \nEnter your movie title on the text box. \nClick on Recommend and a list of similar movies will pop up.")
if __name__ == '__main__':
main()

Binary file added streamlit_app/Kmeans.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added streamlit_app/KmeansTeam.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added streamlit_app/Movie.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added streamlit_app/Moviepic
Binary file not shown.
62,424 changes: 62,424 additions & 0 deletions streamlit_app/movies.csv

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions streamlit_app/pages/2_eda.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Streamlit dependencies
import streamlit as st

# Data dependencies
import numpy as np
import pandas as pd
import PIL
from PIL import Image

def main():
img = Image.open('Kmeans.PNG')
img1 = img.resize((2000,300))
df = pd.read_csv('movies.csv')
col1, col2, col3 = st.columns(3)
with col1:
st.text("")
with col2:
st.image(img1, caption=None, use_column_width=True)
with col3:
st.text("")
st.subheader("Data Exploration")
st.markdown("The dataset used for the set up of this movie recommendation system is a dataset gotten from the internet movie database (imdb). The dataset contains 62423 movies spanning various movie genres. Below are informations about the dataset:")
st.dataframe(df)
if __name__ == '__main__':
main()
112 changes: 112 additions & 0 deletions streamlit_app/pages/3_Kmeans_recommender.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
"""

Streamlit webserver-based Recommender Engine.

Author: Explore Data Science Academy.

Note:
---------------------------------------------------------------------
Please follow the instructions provided within the README.md file
located within the root of this repository for guidance on how to use
this script correctly.

NB: !! Do not remove/modify the code delimited by dashes !!

This application is intended to be partly marked in an automated manner.
Altering delimited code may result in a mark of 0.
---------------------------------------------------------------------

Description: This file is used to launch a minimal streamlit web
application. You are expected to extend certain aspects of this script
and its dependencies as part of your predict project.

For further help with the Streamlit framework, see:

https://docs.streamlit.io/en/latest/

"""
# Streamlit dependencies
import streamlit as st

# Data handling dependencies
import pandas as pd
import numpy as np

# Custom Libraries
from utils.data_loader import load_movie_titles
from recommenders.collaborative_based import collab_model
from recommenders.content_based import content_model

# Data Loading
title_list = load_movie_titles('resources/data/movies.csv')

# App declaration
def main():

# DO NOT REMOVE the 'Recommender System' option below, however,
# you are welcome to add more options to enrich your app.
page_options = ["Recommender System","Solution Overview"]

# -------------------------------------------------------------------
# ----------- !! THIS CODE MUST NOT BE ALTERED !! -------------------
# -------------------------------------------------------------------
page_selection = st.sidebar.selectbox("Choose Option", page_options)
if page_selection == "Recommender System":
# Header contents
st.write('# Movie Recommender Engine')
st.write('### EXPLORE Data Science Academy Unsupervised Predict')
st.image('resources/imgs/Image_header.png',use_column_width=True)
# Recommender System algorithm selection
sys = st.radio("Select an algorithm",
('Content Based Filtering',
'Collaborative Based Filtering'))

# User-based preferences
st.write('### Enter Your Three Favorite Movies')
movie_1 = st.selectbox('Fisrt Option',title_list[14930:15200])
movie_2 = st.selectbox('Second Option',title_list[25055:25255])
movie_3 = st.selectbox('Third Option',title_list[21100:21200])
fav_movies = [movie_1,movie_2,movie_3]

# Perform top-10 movie recommendation generation
if sys == 'Content Based Filtering':
if st.button("Recommend"):
try:
with st.spinner('Crunching the numbers...'):
top_recommendations = content_model(movie_list=fav_movies,
top_n=10)
st.title("We think you'll like:")
for i,j in enumerate(top_recommendations):
st.subheader(str(i+1)+'. '+j)
except:
st.error("Oops! Looks like this algorithm does't work.\
We'll need to fix it!")


if sys == 'Collaborative Based Filtering':
if st.button("Recommend"):
try:
with st.spinner('Crunching the numbers...'):
top_recommendations = collab_model(movie_list=fav_movies,
top_n=10)
st.title("We think you'll like:")
for i,j in enumerate(top_recommendations):
st.subheader(str(i+1)+'. '+j)
except:
st.error("Oops! Looks like this algorithm does't work.\
We'll need to fix it!")


# -------------------------------------------------------------------

# ------------- SAFE FOR ALTERING/EXTENSION -------------------
if page_selection == "Solution Overview":
st.title("Solution Overview")
st.write("Describe your winning approach on this page")

# You may want to add more sections here for aspects such as an EDA,
# or to provide your business pitch.


if __name__ == '__main__':
main()
30 changes: 30 additions & 0 deletions streamlit_app/pages/4_about_us.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Streamlit dependencies
import streamlit as st

# Data dependencies
import numpy as np
import pandas as pd
import PIL
from PIL import Image

def main():
img = Image.open('Kmeans.PNG')
img1 = img.resize((2000,300))
col1, col2, col3 = st.columns(3)
with col1:
st.text("")
with col2:
st.image(img1, caption=None, use_column_width=True)
with col3:
st.text("")

st.subheader("About Us")
st.markdown("KMeans AI is an Artificial Integlligence and Data Analytics services company with its headquarter in Lagos, Nigeria. In over 10 years of its existence as a tech company, KMeans has served over 5 thousand businesses globally, leveraging on robust technologies in the Data and AI space. With a strong and an experienced team of Data professionals, KMeans bring solutions to real life problems using data driven techniques. For more information about us, visit https://www.kmeansAI.com")
st.subheader("Meet the team")

img2 = Image.open('KmeansTeam.png')
img3 = img2.resize((1500,1000))
st.image(img3, caption=None, use_column_width=True)
st.markdown("Asides helping businesses solve real life problems, KMeans AI also have a network of aspiring data professionals from Africa. Being that the entire KMeans AI team is made up of Africans and the organization has gone globally, KMeans AI created the network as a way of giving back to the society that made them. The KMeans AI team train young Africans on various tech paths such as Data Analytics, Data Science, Software Development to mention but a few. KMeans AI also give them the opportunity to intern with them, giving them the opportunity of expereincing how the working environment works.")
if __name__ == '__main__':
main()