https://github.com/usmanx191/book-recommendation-system
This project is a book recommendation system using the Google Books API to suggest books based on user preferences like genre, author, or keywords. It features a FastAPI backend, a Streamlit frontend for user input, and an OpenAI-powered AI chatbot for query assistance and personalized recommendations.
https://github.com/usmanx191/book-recommendation-system
fastapi google-books-api openai-api openai-assistant-api python streamlit
Last synced: about 2 months ago
JSON representation
This project is a book recommendation system using the Google Books API to suggest books based on user preferences like genre, author, or keywords. It features a FastAPI backend, a Streamlit frontend for user input, and an OpenAI-powered AI chatbot for query assistance and personalized recommendations.
- Host: GitHub
- URL: https://github.com/usmanx191/book-recommendation-system
- Owner: usmanX191
- License: mit
- Created: 2024-12-09T23:15:48.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-17T11:16:30.000Z (over 1 year ago)
- Last Synced: 2025-02-12T20:51:22.214Z (over 1 year ago)
- Topics: fastapi, google-books-api, openai-api, openai-assistant-api, python, streamlit
- Language: Python
- Homepage: https://book-recommendation-system-react-app.replit.app/
- Size: 44.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Book Recommendation System Assistant
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.
## Streamlit Front-End View
- Click here to View [Streamlit Front-End](https://book-recommendation-system.replit.app/)
https://github.com/user-attachments/assets/6a2a3ef7-e72c-4089-b519-093d3de0edb9

## React Front-End View
- Click here to View [React Front-End](https://book-recommendation-system-react-app.replit.app/)



## Project Workflow
### Input
- User provides preferences such as:
- Genre (e.g., "fantasy," "science fiction," "romance")
- Optional author or keyword filter
### Processing
- 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.
### Output
- Return a list of book recommendations, including:
- Title, author, genre
- A brief description
- Average rating (if available)
## Files in the Project
- **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.
## How to Run the Project
### Prerequisites
Make sure you have the following installed:
- Python 3.x
- Streamlit
- FastAPI
- Google Books API access (for fetching book data)
### Setup
1. Clone this repository to your local machine.
2. Navigate to the project folder and create a virtual environment:
- python -m venv myenv
3. Activate the virtual environment:
- On Windows:
- myenv\Scripts\activate
- On macOS/Linux:
- source myenv/bin/activate
4. Install the required dependencies:
- pip install -r requirements.txt
5. Running the Backend (Start the FastAPI server)
- myenv\Scripts\activate
- python main.py
6. The backend will be running at http://localhost:8000.
## Running the Frontend (Streamlit)
1. Open New Terminal & Start the Streamlit frontend:
- myenv\Scripts\activate
- streamlit run frontend.py
2. The frontend will be running at http://localhost:8501.
3. The frontend will open in your browser, where you can provide inputs like genre and receive book recommendations.
## Example Output
For user input like "Recommend books in the fantasy genre," the output will look something like this:
1. The Hobbit by J.R.R. Tolkien
- Description: Bilbo Baggins embarks on an epic journey...
- Rating: 4.7
- More Info: The Hobbit
2. 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
## License
This project is licensed under the MIT License - see the LICENSE file for details.
## Acknowledgements
- 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