Spaces:
Configuration error
Configuration error
Update README.md
Browse files
README.md
CHANGED
@@ -1,26 +1,15 @@
|
|
1 |
-
---
|
2 |
-
title: Book Recommender 01
|
3 |
-
emoji: 📊
|
4 |
-
colorFrom: red
|
5 |
-
colorTo: gray
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 5.14.0
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
-
---
|
11 |
-
|
12 |
# Book Recommender App
|
13 |
|
14 |
This is a book recommendation app built using Python, scikit-learn, and Gradio. It uses TF-IDF vectorization and cosine similarity to recommend books based on their summaries.
|
15 |
|
16 |
## Functionality
|
17 |
|
18 |
-
* **File Upload and Processing:** Users can upload CSV or Excel files containing book data (title and summary).
|
19 |
-
* **Data Preprocessing:**
|
20 |
-
* **TF-IDF Vectorization:**
|
21 |
-
* **Similarity Calculation:**
|
22 |
-
* **Book Recommendation:**
|
23 |
-
* **User Interface:**
|
24 |
|
25 |
## Dependencies
|
26 |
|
@@ -32,6 +21,80 @@ This is a book recommendation app built using Python, scikit-learn, and Gradio.
|
|
32 |
|
33 |
1. **Clone the repository:**
|
34 |
|
35 |
-
```bash
|
36 |
-
git clone [https://github.com/](https://github.com/)<your_username>/<your_repo_name>.git # Replace with your repo URL
|
37 |
-
cd <your_repo_name>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# Book Recommender App
|
2 |
|
3 |
This is a book recommendation app built using Python, scikit-learn, and Gradio. It uses TF-IDF vectorization and cosine similarity to recommend books based on their summaries.
|
4 |
|
5 |
## Functionality
|
6 |
|
7 |
+
* **File Upload and Processing:** Users can upload CSV or Excel files containing book data (title and summary). This uses the `pandas` library.
|
8 |
+
* **Data Preprocessing:** Handles missing values and removes duplicates using `pandas`.
|
9 |
+
* **TF-IDF Vectorization:** Converts book summaries to numerical vectors using `scikit-learn`'s `TfidfVectorizer`.
|
10 |
+
* **Similarity Calculation:** Calculates cosine similarity between TF-IDF vectors using `scikit-learn`.
|
11 |
+
* **Book Recommendation:** Recommends similar books based on a user-provided title.
|
12 |
+
* **User Interface:** Provides an interactive interface using `gradio`.
|
13 |
|
14 |
## Dependencies
|
15 |
|
|
|
21 |
|
22 |
1. **Clone the repository:**
|
23 |
|
24 |
+
```bash
|
25 |
+
git clone [https://github.com/](https://github.com/)<your_username>/<your_repo_name>.git # Replace with your repo URL
|
26 |
+
cd <your_repo_name>
|
27 |
+
```
|
28 |
+
|
29 |
+
2. **Create a virtual environment (recommended):**
|
30 |
+
|
31 |
+
```bash
|
32 |
+
python3 -m venv .venv # Create a virtual environment (Linux/macOS)
|
33 |
+
source .venv/bin/activate # Activate the environment (Linux/macOS)
|
34 |
+
.venv\Scripts\activate # Activate the environment (Windows)
|
35 |
+
```
|
36 |
+
|
37 |
+
3. **Install the dependencies:**
|
38 |
+
|
39 |
+
```bash
|
40 |
+
pip install -r requirements.txt
|
41 |
+
```
|
42 |
+
|
43 |
+
4. **Run the app:**
|
44 |
+
|
45 |
+
```bash
|
46 |
+
python app.py
|
47 |
+
```
|
48 |
+
|
49 |
+
5. **Open the app in your browser:** Gradio will provide a URL (usually `http://127.0.0.1:7860/`).
|
50 |
+
|
51 |
+
## How to Deploy on Hugging Face Spaces
|
52 |
+
|
53 |
+
1. **Create a Hugging Face account:** If you don't have one, sign up at [huggingface.co](https://huggingface.co).
|
54 |
+
|
55 |
+
2. **Create a new Space:**
|
56 |
+
* Click on "New Space."
|
57 |
+
* Give your Space a name.
|
58 |
+
* Select the "Gradio" SDK.
|
59 |
+
* Choose a hardware and storage upgrade if needed.
|
60 |
+
* Select a license (e.g., MIT).
|
61 |
+
* Click "Create Space."
|
62 |
+
|
63 |
+
3. **Push your code to the Space:**
|
64 |
+
* Clone the newly created Git repository:
|
65 |
+
|
66 |
+
```bash
|
67 |
+
git clone [https://huggingface.co/spaces/](https://huggingface.co/spaces/)<your_username>/<your_space_name>
|
68 |
+
cd <your_space_name>
|
69 |
+
```
|
70 |
+
|
71 |
+
* Copy all the necessary files (`app.py`, `requirements.txt`, your data file, `README.md`, `config.yaml`) into the cloned repository.
|
72 |
+
* Commit and push your changes:
|
73 |
+
|
74 |
+
```bash
|
75 |
+
git add .
|
76 |
+
git commit -m "Initial commit"
|
77 |
+
git push origin main
|
78 |
+
```
|
79 |
+
|
80 |
+
4. **Wait for the build:** Hugging Face Spaces will automatically build your app. Monitor the build progress on your Space page.
|
81 |
+
|
82 |
+
5. **Access your deployed app:** Once the build is successful, your app will be live at a URL provided by Hugging Face.
|
83 |
+
|
84 |
+
## Data File
|
85 |
+
|
86 |
+
The app requires a CSV or Excel file containing book data, including at least the `title` and `summary` columns. The file should be named (e.g., `books.csv`) and placed in the same directory as `app.py`. The path to the file is specified in the `load_data` method of the `BookRecommender` class within `app.py`.
|
87 |
+
|
88 |
+
## Example Usage
|
89 |
+
|
90 |
+
1. Upload your book data file.
|
91 |
+
2. Enter the title of a book you like.
|
92 |
+
3. The app will recommend similar books.
|
93 |
+
|
94 |
+
## Contributing
|
95 |
+
|
96 |
+
Contributions are welcome! Please open an issue or submit a pull request.
|
97 |
+
|
98 |
+
## License
|
99 |
+
|
100 |
+
[MIT License](LICENSE) (Or your chosen license)
|