Skip to content

Latest commit

Β 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Smart Document Analyzer πŸ“„πŸ€–

An AI-powered document-processing system built using Amazon Textract, AWS Lambda, Amazon Bedrock/SageMaker, and a serverless cloud-native architecture.
This application extracts text from PDFs/images, generates intelligent summaries, and enables question-answering using Retrieval-Augmented Generation (RAG).


πŸš€ Features

πŸ” Intelligent OCR

  • Upload PDFs or images
  • Extracts structured text using Amazon Textract
  • Supports multi-page documents

🧠 AI Summaries

  • Automated text summarization
  • TL;DR bullet generation
  • Powered by Amazon Bedrock or SageMaker JumpStart models

❓ Ask-Anything Q&A

  • Ask natural-language questions about the uploaded document
  • Uses RAG (chunking + embeddings + context retrieval)
  • Generates accurate responses using LLMs

☁️ Serverless Architecture

  • No servers to manage
  • Highly scalable
  • Low-cost for student projects

πŸ—οΈ Architecture

                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                 β”‚        Frontend          β”‚
                 β”‚  (React + Amplify)       β”‚
                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
                              β–Ό
                      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                      β”‚ API Gatewayβ”‚
                      β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜
                             β”‚
               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
               β”‚             β”‚                   β”‚
               β–Ό             β–Ό                   β–Ό
      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
      β”‚ Upload Handler β”‚  β”‚ OCR Lambda     β”‚  β”‚ Q/A Lambda     β”‚
      β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚                   β”‚                   β”‚
              β–Ό                   β–Ό                   β–Ό
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚ S3 Upload β”‚     β”‚ Textract OCR β”‚     β”‚ LLM Summary   β”‚
        β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚                   β”‚                   β”‚
              β–Ό                   β–Ό                   β–Ό
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚ Raw Text S3  β”‚   β”‚ DynamoDB Metaβ”‚   β”‚ Bedrock/SageMakerβ”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“ Project Structure

smart-document-analyzer/
β”‚
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ textract-handler.py         # OCR + text extraction Lambda
β”‚   β”œβ”€β”€ nlp-processor.py            # Summarization + embeddings
β”‚   β”œβ”€β”€ query-handler.py            # Q/A Lambda function
β”‚   └── utils/                      # Helper scripts
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/                        # React frontend
β”‚   β”œβ”€β”€ public/
β”‚   └── package.json
β”‚
β”œβ”€β”€ infrastructure/
β”‚   β”œβ”€β”€ cdk/ or cloudformation/     # Infra as code
β”‚   └── iam-policies/
β”‚
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ architecture.png
β”‚   β”œβ”€β”€ demo-screenshots/
β”‚   └── samples/
β”‚
β”œβ”€β”€ README.md
└── LICENSE

βš™οΈ Installation & Setup

1️⃣ Clone Repository

git clone https://github.com/<your-username>/smart-document-analyzer.git
cd smart-document-analyzer

2️⃣ Install Backend Dependencies

pip install -r backend/requirements.txt

3️⃣ Configure AWS Credentials

aws configure

Make sure your IAM user has permissions for:

  • S3
  • Lambda
  • Textract
  • DynamoDB
  • Bedrock / SageMaker
  • API Gateway

4️⃣ Deploy Backend Infrastructure

Using AWS CDK:

cd infrastructure/cdk
cdk deploy

5️⃣ Start Frontend

cd frontend
npm install
npm start

πŸ§ͺ How the System Works

1. Upload Document

User uploads a PDF/image β†’ sent to S3 via pre-signed URL.

2. OCR Trigger

S3 event triggers a Lambda function:

  • Calls Amazon Textract
  • Extracts text
  • Saves cleaned text to S3

3. NLP Processing

A second Lambda:

  • Chunks text
  • Generates embeddings
  • Creates summary using LLM
  • Saves metadata to DynamoDB

4. Q&A Pipeline

User provides a question:

  • System retrieves relevant text chunks (RAG)
  • LLM generates the best answer

🧩 API Endpoints

Method Endpoint Description
POST /upload Generates pre-signed S3 upload URL
GET /status/{docId} Returns processing status + summary
POST /ask/{docId} Answers questions about the document

πŸ’° AWS Cost Optimization

To stay within student credits ($199.78):

  • Use Textract on small PDFs (≀ 5 pages)
  • Delete SageMaker endpoints when not in use
  • Prefer Bedrock for serverless LLM inference
  • Enable S3 lifecycle rules to auto-delete temporary files
  • Enable Billing alerts

πŸ“Έ Screenshots (Add After Deployment)

Place images under docs/demo-screenshots/ and include examples here:

![Upload Page](docs/demo-screenshots/upload.png)
![Summary Example](docs/demo-screenshots/summary.png)
![Q&A Interface](docs/demo-screenshots/qa.png)

🧰 Tech Stack

Frontend

  • React
  • AWS Amplify

Backend

  • AWS Lambda
  • Amazon API Gateway
  • Amazon S3
  • Amazon DynamoDB
  • Amazon Textract

AI

  • Amazon Bedrock
    or
  • AWS SageMaker JumpStart

🀝 Contributing

Contributions, issues, and feature requests are welcome!
Feel free to open a PR or fork the project.


πŸ“„ License

This project is licensed under the MIT License.
See the LICENSE file for full details.


πŸ‘€ Author

SriSaiKiran Tambalkar
B.Tech CSE (AIML) Student
GitHub: https://github.com/
LinkedIn: https://www.linkedin.com/in

About

A AIML + Cloud project, which helps the user to upload the document(pdf)/image and extract the text using AWS textract service and storing the raw text in AWS S3/Dynamo DB, using AWS SageMaker for LLM summerization and AWS Bedrock for Q&A.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages