A comprehensive Flask-based AI web application that helps users quickly understand books by generating summaries, mind maps, flashcards, and Q&A pairs using HuggingFace Transformers, PyTorch, and NLP techniques.
- User Authentication: Secure regicster/login with Flask-Login and bcrypt.
- Book Parsing: Upload
.txtor.pdffiles, or paste raw text. - AI Summarization: Automatically chunk and summarize texts using
sshleifer/distilbart-cnn-12-6. - Mind Map Generation: Extractive NLP concept generation visualized interactively via D3.js.
- Study Flashcards & Q&A: Employs T5 text-to-text generation (via
google/flan-t5-small) to create context-aware study material. - Admin Dashboard: Administrator views for managing users and books.
- Standalone CLI Summarizer: Includes a dedicated command-line book summarizer (
bart_summarizer.py) for processing large chunks of text directly from the terminal.
Internship_Project/
├── app/ # Main Flask application package
│ ├── models/ # SQLAlchemy database models
│ ├── routes/ # Application blueprints and routes
│ ├── services/ # Core business logic and AI processing
│ └── utils/ # Helper functions and utilities
├── static/ # CSS, JS, and image assets
├── templates/ # HTML Jinja2 templates
├── tests/ # Unit tests for the application
├── bart_summarizer.py # Standalone CLI summarization script
├── requirements.txt # Python dependencies
├── run.py # Main entry point for the Flask server
└── .env # Environment variables for configuration
-
Clone the repository and enter the directory
git clone <repository-url> cd Internship_Project
-
Create a Python Virtual Environment
python -m venv venv # On Windows: .\venv\Scripts\Activate.ps1 # On Linux/Mac: source venv/bin/activate
-
Install Dependencies
pip install -r requirements.txt
(Note: This project uses
PyTorchandTransformers. Downloading models may require significant storage, e.g., ~300MB for the DistilBART model). -
NLTK Setup Run the following to download necessary linguistic data for the mind map extractor:
python -c "import nltk; nltk.download('punkt'); nltk.download('punkt_tab'); nltk.download('stopwords'); nltk.download('averaged_perceptron_tagger'); nltk.download('averaged_perceptron_tagger_eng')" -
Start PostgreSQL Database Ensure PostgreSQL is running locally. Update the database URI in the
.envfile if necessary:DATABASE_URL=postgresql://postgres:postgres@localhost/book_learning_db
Note: Ensure the database
book_learning_dbactually exists in your PostgreSQL cluster before running.
python run.pyThe Flask app will create necessary database tables automatically upon the first run.
Access the app at http://127.0.0.1:5000/.
You can use the built-in CLI tool to quickly summarize text without starting the web server:
python bart_summarizer.pyRun the provided unit tests using:
python -m unittest discover tests/