Collaborative and Popularity based Recommendation System using Flask and WebDev
Developed A python App on Pycharm (app.py) using Flask and WebDev which Recommends book on the basis of Book searched.
There are 4 types of recommendation systems:
-
Popularity Based : Recommendations are provided on the basis of Popularity. Trending Books are shown. This type of system uses formula for accessing popular Books.
-
Content Based : Recommendations are provided on the basis of Type of content acessed by user.This is done by creating tags.
-
Collaborative Filtering Based : Recommendations on the basis of common interests shared by multiple users.
-
Hybrid : Which used both content and collaborative Filtering
I have used Flask Python Framework to create this Website app and used renderTemplate to showcase the html page.
And pickle library to make pickle files to be used to extract data in app.py and data is being uploaded through Book_Recommendation.ipynb
- In app.py file :Written code to load the content from pickle file into Diff datasets
popular_df=pickle.load(open('popular.pkl','rb'))
pt=pickle.load(open('pt.pkl','rb'))
books=pickle.load(open('books.pkl','rb'))
similarity_scores=pickle.load(open('similarity_scores.pkl','rb'))
- In Book_Recommendation.ipynb
#for polarity based recommendation
import pickle
pickle.dump(popular_df,open('popular.pkl','wb'))
#for the collaborative recommendation
pickle.dump(pt,open('pt.pkl','wb'))
pickle.dump(books,open('books.pkl','wb'))
pickle.dump(similarity_scores,open('similarity.pkl','wb'))
Heroku requires : requirements.txt file and ProcFile (The code of each is written Down)
In the terminal of pycharm write following lines to deploy the project :
git init
heroku login
git add .
git commit -m "message"
git push heroku master
- requirements.txt
write this code in requirements.txt file :
flask
numpy
pandas
gunicorn
- Procfile
web: gunicorn app:app