zaiffi commited on
Commit
8caef53
·
verified ·
1 Parent(s): e653f5e

Upload 11 files

Browse files

Added README (proper documentation)
EmailJS integrated
Public Assets
No Node Modules (line in .gitignore)
.pkl files load directly from hugging face

Files changed (7) hide show
  1. .env +3 -0
  2. .gitignore +9 -1
  3. README.md +149 -2
  4. app.py +32 -5
  5. package-lock.json +20 -0
  6. package.json +5 -0
  7. requirements.txt +0 -0
.env ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ VITE_EMAILJS_SERVICE_ID=service_fv67f0a
2
+ VITE_EMAILJS_TEMPLATE_ID=template_z144ne5
3
+ VITE_EMAILJS_PUBLIC_KEY=Xre_Zswcw6OPTI70H
.gitignore CHANGED
@@ -4,6 +4,13 @@ env/
4
  ENV/
5
  .env
6
 
 
 
 
 
 
 
 
7
  # Python cache files
8
  __pycache__/
9
  *.py[cod]
@@ -42,12 +49,13 @@ wheels/
42
  *.log
43
  logs/
44
  log/
45
-
46
  # Database
47
  *.db
48
  *.sqlite3
49
 
50
  # Model files
 
51
  *.model
52
  *.h5
53
 
 
4
  ENV/
5
  .env
6
 
7
+ # Node.js
8
+ node_modules/
9
+ npm-debug.log*
10
+ yarn-debug.log*
11
+ yarn-error.log*
12
+
13
+
14
  # Python cache files
15
  __pycache__/
16
  *.py[cod]
 
49
  *.log
50
  logs/
51
  log/
52
+
53
  # Database
54
  *.db
55
  *.sqlite3
56
 
57
  # Model files
58
+ *.pkl
59
  *.model
60
  *.h5
61
 
README.md CHANGED
@@ -1,2 +1,149 @@
1
- # BookQuest-
2
- Adventure in finding great reads
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: BookQuest
3
+ emoji: 📚
4
+ colorFrom: blue
5
+ colorTo: yellow
6
+ sdk: docker
7
+ sdk_version: 3.1.1
8
+ app_file: app.py
9
+ pinned: false
10
+ ---
11
+
12
+ # BookQuest: Adventure in Finding Great Reads
13
+
14
+ BookQuest is an intelligent book recommendation platform that helps you discover your next favorite read. Whether you're looking for classics, trending titles, or personalized suggestions, BookQuest makes finding great books effortless and enjoyable.
15
+
16
+ ![Top 50 Books](public/Top_50_Books.png)
17
+
18
+ ## Problem Statement
19
+
20
+ Finding the right book can be overwhelming with the sheer volume of options available. Readers often struggle to:
21
+ - Discover books tailored to their interests
22
+ - Get reliable recommendations
23
+ - Explore new genres and authors
24
+ - Connect with a modern, user-friendly interface
25
+
26
+ BookQuest solves these challenges by providing curated lists, smart recommendations, and a beautiful, intuitive experience.
27
+
28
+ ## Features
29
+
30
+ - **Top 50 Books**: Instantly browse the most popular and highly rated books
31
+ - **Personalized Recommendations**: Get book suggestions based on your favorite titles
32
+ - **Modern UI**: Clean, responsive design with a focus on readability and ease of use
33
+ - **Contact Form**: Reach out for support or suggestions directly from the app
34
+ - **Live Search**: Quickly find books by title
35
+ - **Robust Backend**: Powered by Flask and machine learning models for accurate recommendations
36
+ - **Email Notifications**: Contact form uses EmailJS for instant communication
37
+
38
+ ![Contact Us](public/contact_us(1).png)
39
+
40
+ ## Tech Stack
41
+
42
+ - **Frontend & Application**: Flask, Bootstrap, HTML/CSS, Jinja2
43
+ - **Backend**: Python, Pandas, Numpy, Scikit-learn
44
+ - **Recommendation Engine**: Collaborative filtering using similarity scores
45
+ - **Email Integration**: EmailJS (client-side)
46
+ - **Deployment**: Docker, Hugging Face Spaces
47
+
48
+ ## Getting Started
49
+
50
+ ### Prerequisites
51
+
52
+ - Python 3.8 or later
53
+ - pip (Python package manager)
54
+ - (Optional) Docker for containerized deployment
55
+
56
+ ### Installation
57
+
58
+ 1. **Clone the repository:**
59
+ ```bash
60
+ git clone https://github.com/zaiffishiekh01/BookQuest.git
61
+ cd BookQuest
62
+ ```
63
+
64
+ 2. **Install required packages:**
65
+ ```bash
66
+ pip install -r requirements.txt
67
+ ```
68
+
69
+ 3. **Create a `.env` file in the project root with your EmailJS credentials:**
70
+ ```env
71
+ SECRET_KEY=your-secret-key-here
72
+ VITE_EMAILJS_PUBLIC_KEY=your-public-key-here
73
+ VITE_EMAILJS_SERVICE_ID=your-service-id-here
74
+ VITE_EMAILJS_TEMPLATE_ID=your-template-id-here
75
+ ```
76
+
77
+ ### Running the Application
78
+
79
+ Start the Flask app:
80
+ ```bash
81
+ flask run --host=0.0.0.0 --port=7860
82
+ ```
83
+
84
+ Or use Docker:
85
+ ```bash
86
+ docker build -t bookquest .
87
+ docker run -p 7860:7860 bookquest
88
+ ```
89
+
90
+ The application will be available at `http://localhost:7860`.
91
+
92
+ ## Usage Guide
93
+
94
+ ### Home Page (Top 50 Books)
95
+ - Browse the most popular books with cover images, authors, ratings, and more.
96
+ - Click on any book for more details.
97
+
98
+ ![Top 50 Books](public/Top_50_Books.png)
99
+
100
+ ### Recommendations
101
+ - Enter a book title you like and get a list of similar books instantly.
102
+ - Each recommendation includes cover, author, year, and publisher.
103
+
104
+ ![Book Recommendations](public/Book_recommendations(1).png)
105
+ ![Book Recommendations](public/Book_recommendations(2).png)
106
+
107
+ ### Contact Us
108
+ - Use the contact form to send feedback or questions.
109
+ - EmailJS integration ensures your message is delivered instantly.
110
+
111
+ ![Contact Us](public/contact_us(1).png)
112
+ ![Contact Us](public/contact_us(2).png)
113
+
114
+ ## Environment Variables
115
+
116
+ For security, do not share your actual `.env` file. Use this template:
117
+
118
+ ```env
119
+ SECRET_KEY=your-secret-key-here
120
+ VITE_EMAILJS_PUBLIC_KEY=your-public-key-here
121
+ VITE_EMAILJS_SERVICE_ID=your-service-id-here
122
+ VITE_EMAILJS_TEMPLATE_ID=your-template-id-here
123
+ ```
124
+
125
+ ## Hugging Face Spaces Integration
126
+
127
+ When deploying on Hugging Face Spaces, use their Secret Management for your environment variables:
128
+ 1. Go to your Space settings
129
+ 2. Add each variable from your `.env` file as a secret
130
+ 3. Hugging Face Spaces will make these available to your app
131
+
132
+ ## Troubleshooting
133
+
134
+ - **Email Not Sending**: Check your EmailJS credentials and template IDs
135
+ - **Book Data Not Loading**: Ensure you have internet access to fetch remote model files
136
+ - **Docker Issues**: Make sure Docker is installed and running
137
+ - **UI Problems**: Clear your browser cache or try a different browser
138
+
139
+ ## About the Developer
140
+
141
+ Developed by Muhammad Huzaifa Saqib (zaiffi), passionate about building AI-powered tools for readers and learners.
142
+
143
+ - GitHub: [zaiffishiekh01](https://github.com/zaiffishiekh01)
144
+ - LinkedIn: [Muhammad Huzaifa Saqib](https://www.linkedin.com/in/muhammad-huzaifa-saqib-90a1a9324/)
145
+ - Email: huzaifasaqib420@gmail.com
146
+
147
+ ---
148
+
149
+ Enjoy your journey to great reads with **BookQuest**! 📚
app.py CHANGED
@@ -1,14 +1,41 @@
1
  from flask import Flask,render_template,request, flash, redirect, url_for
2
  import pickle
3
  import numpy as np
 
 
 
 
4
 
5
- popular_df = pickle.load(open('popular.pkl','rb'))
6
- pt = pickle.load(open('pt.pkl','rb'))
7
- books = pickle.load(open('books.pkl','rb'))
8
- similarity_scores = pickle.load(open('similarity_scores.pkl','rb'))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  app = Flask(__name__)
11
- app.secret_key = 'your-secret-key-here' # Required for flash messages
 
 
 
 
 
12
 
13
  @app.route("/")
14
  def index():
 
1
  from flask import Flask,render_template,request, flash, redirect, url_for
2
  import pickle
3
  import numpy as np
4
+ import os
5
+ from dotenv import load_dotenv
6
+ import requests
7
+ from io import BytesIO
8
 
9
+ # Load environment variables
10
+ load_dotenv()
11
+
12
+ def load_pickle_from_url(url, local_filename):
13
+ if os.path.exists(local_filename):
14
+ with open(local_filename, 'rb') as f:
15
+ return pickle.load(f)
16
+ response = requests.get(url)
17
+ response.raise_for_status()
18
+ with open(local_filename, 'wb') as f:
19
+ f.write(response.content)
20
+ return pickle.load(BytesIO(response.content))
21
+
22
+ POPULAR_URL = "https://huggingface.co/zaiffi/BookQuest/resolve/main/popular.pkl"
23
+ PT_URL = "https://huggingface.co/zaiffi/BookQuest/resolve/main/pt.pkl"
24
+ BOOKS_URL = "https://huggingface.co/zaiffi/BookQuest/resolve/main/books.pkl"
25
+ SIMILARITY_URL = "https://huggingface.co/zaiffi/BookQuest/resolve/main/similarity_scores.pkl"
26
+
27
+ popular_df = load_pickle_from_url(POPULAR_URL, "popular.pkl")
28
+ pt = load_pickle_from_url(PT_URL, "pt.pkl")
29
+ books = load_pickle_from_url(BOOKS_URL, "books.pkl")
30
+ similarity_scores = load_pickle_from_url(SIMILARITY_URL, "similarity_scores.pkl")
31
 
32
  app = Flask(__name__)
33
+ app.secret_key = os.getenv('SECRET_KEY', 'your-secret-key-here')
34
+
35
+ # EmailJS Configuration
36
+ app.config['EMAILJS_PUBLIC_KEY'] = os.getenv('VITE_EMAILJS_PUBLIC_KEY')
37
+ app.config['EMAILJS_SERVICE_ID'] = os.getenv('VITE_EMAILJS_SERVICE_ID')
38
+ app.config['EMAILJS_TEMPLATE_ID'] = os.getenv('VITE_EMAILJS_TEMPLATE_ID')
39
 
40
  @app.route("/")
41
  def index():
package-lock.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "BookQuest",
3
+ "lockfileVersion": 3,
4
+ "requires": true,
5
+ "packages": {
6
+ "": {
7
+ "dependencies": {
8
+ "@emailjs/browser": "^4.4.1"
9
+ }
10
+ },
11
+ "node_modules/@emailjs/browser": {
12
+ "version": "4.4.1",
13
+ "resolved": "https://registry.npmjs.org/@emailjs/browser/-/browser-4.4.1.tgz",
14
+ "integrity": "sha512-DGSlP9sPvyFba3to2A50kDtZ+pXVp/0rhmqs2LmbMS3I5J8FSOgLwzY2Xb4qfKlOVHh29EAutLYwe5yuEZmEFg==",
15
+ "engines": {
16
+ "node": ">=14.0.0"
17
+ }
18
+ }
19
+ }
20
+ }
package.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "dependencies": {
3
+ "@emailjs/browser": "^4.4.1"
4
+ }
5
+ }
requirements.txt CHANGED
Binary files a/requirements.txt and b/requirements.txt differ