This project is a book recommendation system that leverages the Google Books API to recommend books based on user preferences such as genre, author, or keywords. It features a backend service built with FastAPI and a frontend interface developed using Streamlit for interactive user input. Additionally, it incorporates the OpenAI Assistant API to assist with user queries, providing an AI-powered chatbot experience for enhanced user interaction and personalized recommendations.
- Click here to View Streamlit Front-End
Book.Recommendation.System.Streamlit.App.mp4
- Click here to View React Front-End
- User provides preferences such as:
- Genre (e.g., "fantasy," "science fiction," "romance")
- Optional author or keyword filter
- Query the Google Books API using the provided genre and optional filters.
- Extract and format relevant book details like title, author, description, and average rating.
- Return a list of book recommendations, including:
- Title, author, genre
- A brief description
- Average rating (if available)
- main.py: Backend file using FastAPI to handle API requests for fetching book recommendations.
- frontend.py: Frontend file using Streamlit to provide an interactive UI for the user to enter preferences.
- requirements.txt: List of dependencies required for the project.
- .gitignore: Specifies files and directories to be ignored by Git.
- .env: Environment variables for sensitive information like API keys.
- pycache: Compiled Python files.
- myenv: Virtual environment folder for the project.
Make sure you have the following installed:
- Python 3.x
- Streamlit
- FastAPI
- Google Books API access (for fetching book data)
-
Clone this repository to your local machine.
-
Navigate to the project folder and create a virtual environment:
- python -m venv myenv
-
Activate the virtual environment:
- On Windows:
- myenv\Scripts\activate
- On macOS/Linux:
- source myenv/bin/activate
- On Windows:
-
Install the required dependencies:
- pip install -r requirements.txt
-
Running the Backend (Start the FastAPI server)
- myenv\Scripts\activate
- python main.py
-
The backend will be running at http://localhost:8000.
-
Open New Terminal & Start the Streamlit frontend:
- myenv\Scripts\activate
- streamlit run frontend.py
-
The frontend will be running at http://localhost:8501.
-
The frontend will open in your browser, where you can provide inputs like genre and receive book recommendations.
For user input like "Recommend books in the fantasy genre," the output will look something like this:
-
The Hobbit by J.R.R. Tolkien
- Description: Bilbo Baggins embarks on an epic journey...
- Rating: 4.7
- More Info: The Hobbit
-
Harry Potter and the Sorcerer's Stone by J.K. Rowling
- Description: A young wizard begins his magical education...
- Rating: 4.8
- More Info: Harry Potter
This project is licensed under the MIT License - see the LICENSE file for details.
- Google Books API: Used for fetching book data.
- FastAPI: Used for backend development.
- Streamlit: Used for frontend development.
- OpenAI Assistant API: Used for assistance with user queries



