Description:
- The user uploads a PDF file and fills in the information.
- The file is sent to the backend server to be processed.
- The backend server using tysseract and HuggingFace models does the following:
- Extracts the text from the PDF file.
- Summarizes the text.
- Predicts the topics of the text.
- Predicts the sentiment of the text.
- The results are sent back to the user and displayed on the screen.
- The user can then edit the information if needed. After that, the user can confirm and the information will be added to the MongoDB database.
Description:
- The user enters a query in the search bar.
- The query is sent to the backend server to be processed.
- The backend server using HuggingFace models does the following:
- Embeds the summaries of the books in the database.
- Embeds the query.
- Finds the most similar summary to the query.
- Returns the related document.
- The results are sent back to the user and displayed on the screen.
- Additionally, if an OpenAI API key is provided, the query, summary, topic, and sentiment are sent to the OpenAI API to generate a response as a helpful librarian. The response is then displayed on the screen.
Clone the repository
git clone https://github.com/MeshalAlamr/smart-library.git
Move to project directory
cd smart-library
If you want to use the Librarian's Answer feature, you need to provide your OpenAI API key in the .env file. You can get one from here.
Modify the .env file to include your API key
OPENAI_API_KEY='Your Key Here'
This project supports both running on Docker or locally.
Docker
docker compose up
Local
Start by creating a Conda environmnet or whichever environment manager you prefer.
Install requirements
pip install -r requirements.txt
-
From the project directory, navigate to the backend directory
cd services
-
Download the models
python download_models.py
-
Start the backend server
python app.py
Note: The backend server must be running before starting the web server.
-
Start another terminal, from the project directory, navigate to the server directory
cd server
-
Start the server
python run.py