The BookPath(ShuTu) System is an innovative program designed for modern libraries to provide users with precise book recommendations and to plan the optimal route within the library. The whole program is based on Gradio and Langchain-Chatchat. The project team consists of five members, Edwin Yanagisawa, E·M·Lee, Owen Yang, Huai Guan, and Jingke Ao. All members hail from the AIUI course at SJTU. By simply entering their needs, users can receive book suggestions generated by advanced algorithms and obtain an optimal path from their current location to the desired book. Whether for students, researchers, or book enthusiasts, this system significantly enhances the efficiency of finding and borrowing books, saving time and improving the overall experience.
Key features include:
- Intelligent Book Recommendations: Suggests relevant books based on user input, utilizing big data and AI algorithms.
- Optimal Route Planning: Plans the best route from the user’s current location to the desired book's location.
- Real-Time Navigation(May be added in future): Provides real-time navigation within the library to ensure users can quickly locate the needed books.
BookPath/
│
├── configs/ # Model configurations
├── server/ # Model server
├── knowledge_base/ # Knowledge base
├── model/ # Models (we did not upload them because they are too large)
├── Library/ # Library-related configuration files
├── library.jpg # Colored map of the library
├── library_gray.jpg # Grayscale map of the library for navigation
├── books.json # Book configuration file
└── location.json # Bookshelf location configuration file
├── README.md # Project description file
├── README_zh.md # Project description file in Chinese
├── start_up.py # Longchain_Chatchat startup script
├── setup_books.py # Book setup script
├── setup_location.py # Location setup script
└── ui_gradio.py # Gradio frontend startup script
Project Module Descriptions:
- configs/: Contains model configurations and settings, used to manage and configure machine learning models.
- server/: Includes code for the model server, responsible for loading models and handling inference requests.
- knowledge_base/: Stores the knowledge base, including data and information required by the book recommendation algorithms.
- Library/: Contains library-related configuration files, including the library map, book information, and bookshelf locations.
- library.jpg: Colored map of the library for user interface display.
- library_gray.jpg: Grayscale map of the library used for navigation algorithms.
- books.json: Detailed information configuration file for books.
- location.json: Configuration file for bookshelf locations, describing the positions of bookshelves within the library.
- README.md: Project description file, providing an overview and usage instructions for the project.
- start_up.py: Longchain_Chatchat startup script, used to initialize and launch the entire system.
- setup_books.py: Book setup script, used to configure and update book information.
- setup_location.py: Location setup script, used to configure and update bookshelf location information.
- ui_gradio.py: Gradio frontend startup script, used to launch the graphical user interface and provide user interaction.
To set up the BookPath project, follow the steps below:
First, install the necessary dependencies:
pip install -r requirements.txt
Update the files in the Library/
directory according to your specific library setup.
-
location.json
should be formatted as follows:{ "0": [602, 210] }
Here,
"0"
is the location ID, and[602, 210]
represents the coordinates in the image. -
books.json
should be formatted as follows:{ "0": ["Romeo and Juliet"] }
Here,
"0"
is the location ID, and["Romeo and Juliet"]
is the list of books at that location.
You can use the setup_books.py
and setup_location.py
scripts to assist in configuring these files.
Use setup_map.py
to convert Library/library.jpg
into a binary map for navigation purposes. Note that the adaptive thresholding method provides a rough result, and fine adjustments may require additional computer vision techniques or manual editing with software like Photoshop.
Refer to the official Langchain-Chatchat documentation for details on how to use the model and APIs. If you need to run large models locally, place them in the /model
directory and update the relevant settings in model_config.py
.
Here are the url of our models:
!!!important!!! We recommend running this project on a cloud server on a powerful GPU (with a high display memory).
You may need to forward your ports if you want to access the webui on your local device.
Run the following command to start all necessary services:
python3 startup.py --all-api
#For Windows sys,it should be python startup.py --all-api
After all services have started, open a new terminal and run:
python3 ui_gradio.py
#For Windows sys,it should be python ui_gradio.py
You should see the following output:
Running on URL: 127.0.0.1:9001
Open the URL in your web browser to access the application.
Note: You can also try
python3 startup_neo.py --all-api --webui
which will work as well.
-
Compatibility Issues: If you encounter conflicts between
gradio
andfastapi
, try installing a specific version ofgradio
:pip install gradio==3.33.0
-
Proxy Environment: If you have a proxy environment set up on your local machine, you may need to disable the proxy to run the application correctly.
-
Python Version
Python >= 3.9 required (3.10 and 3.11 recommended)
-
Ports
Ensure that the ports are not occupied when running this project.
You can modify the ports of model server in
configs/server_config.py
Run
python3 ui_gradio.py --gradio_port=<your port>
to denote the port for gradio.
if you cannot restart the project, try
./shutdown_all.sh
to kill previously launched service