Skip to content

BookPath is an intelligent library navigation system designed to provide users with efficient and accurate book recommendations and to plan the optimal route within the library.

License

Notifications You must be signed in to change notification settings

Vixurunt/BookPath

Repository files navigation

BOOKPATH(ShuTu)

Ⅰ Summary:

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:

  1. Intelligent Book Recommendations: Suggests relevant books based on user input, utilizing big data and AI algorithms.
  2. Optimal Route Planning: Plans the best route from the user’s current location to the desired book's location.
  3. Real-Time Navigation(May be added in future): Provides real-time navigation within the library to ensure users can quickly locate the needed books.

Ⅱ Project Directory Structure:

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:

  1. configs/: Contains model configurations and settings, used to manage and configure machine learning models.
  2. server/: Includes code for the model server, responsible for loading models and handling inference requests.
  3. knowledge_base/: Stores the knowledge base, including data and information required by the book recommendation algorithms.
  4. 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.
  5. README.md: Project description file, providing an overview and usage instructions for the project.
  6. start_up.py: Longchain_Chatchat startup script, used to initialize and launch the entire system.
  7. setup_books.py: Book setup script, used to configure and update book information.
  8. setup_location.py: Location setup script, used to configure and update bookshelf location information.
  9. ui_gradio.py: Gradio frontend startup script, used to launch the graphical user interface and provide user interaction.

Ⅲ Configuration steps:

To set up the BookPath project, follow the steps below:

Step 1: Install Dependencies

First, install the necessary dependencies:

pip install -r requirements.txt

Step 2: Modify Library Configurations

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.

Step 3: Process Library Map

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.

Step 4: Model and API Configuration

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:



Ⅳ Running the Project

!!!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.

Step 1: Start All APIs

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

Step 2: Launch the Frontend

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.

Ⅴ Notes

  1. Compatibility Issues: If you encounter conflicts between gradio and fastapi, try installing a specific version of gradio:

    pip install gradio==3.33.0
    
  2. 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.

  3. Python Version

    Python >= 3.9 required (3.10 and 3.11 recommended)

  4. 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

About

BookPath is an intelligent library navigation system designed to provide users with efficient and accurate book recommendations and to plan the optimal route within the library.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages