Spaces:
Running
Running
File size: 4,563 Bytes
fc526fe c001f24 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
---
title: Report Generator
emoji: π
colorFrom: blue
colorTo: indigo
sdk: docker
pinned: false
app_port: 7680
---
# DocuPDF: Smart Scanner & PDF Generator
DocuPDF is a web-based utility that transforms images of documentsβlike test papers, notes, or book pagesβinto a polished, organized, and enhanced PDF. It provides powerful 8-point perspective crop, image enhancement tools, and detailed metadata entry, all within your browser.
## β¨ Key Features
### Dual Input Support
- **PDF Upload**: Upload a PDF document and extract individual pages as images
- **Image Upload**: Upload multiple image files directly (PNG, JPG, JPEG, GIF, BMP)
### Advanced Cropping
- Powerful 8-point perspective correction tool
- Draw multiple crop boxes on a single page/image
- Touch-friendly UI with magnifying loupe for precision
### Image Enhancement
- Fine-tune scans with adjustments for:
- Brightness
- Contrast
- Gamma
### Metadata Management
- Add structured metadata to each question:
- Question Number
- Subject
- Status (Correct/Wrong/Unattempted)
- Marked Solution
- Actual Solution
- Time Taken
### Smart Features
- Automatic question number extraction using NVIDIA NIM OCR (when API key is provided)
- Dashboard for session management
- Custom PDF generation with filtering options
### Modern UI
- Responsive design that works on desktop and mobile
- Dark theme for comfortable extended use
- Keyboard shortcuts for power users
## π§ Tech Stack
- **Backend**: Flask (Python)
- **Image Processing**: OpenCV, Pillow, PyMuPDF
- **Frontend**: HTML5, Bootstrap 5, JavaScript
- **Database**: SQLite
- **OCR**: NVIDIA NIM API (optional)
## βοΈ Installation & Setup
### Prerequisites
- Python 3.7+
- pip package installer
### Step-by-Step Guide
1. **Clone the Repository**
```bash
git clone <repository-url>
cd Report-Generator
```
2. **Create and Activate a Virtual Environment (Recommended)**
```bash
# Create the environment
python -m venv venv
# Activate it
# On Windows:
.\venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
```
3. **Install Dependencies**
```bash
pip install -r requirements.txt
```
4. **Run the Application**
```bash
python app.py
```
5. **Open in Browser**
Navigate to `http://127.0.0.1:1302` in your web browser
### Environment Variables (Optional)
To enable the automatic question number extraction feature, set the NVIDIA_API_KEY environment variable:
```bash
# On Linux/macOS:
export NVIDIA_API_KEY="your-api-key-here"
# On Windows:
set NVIDIA_API_KEY=your-api-key-here
# Or create a .env file with:
NVIDIA_API_KEY=your-api-key-here
```
If you don't set this variable, the application will still work but the automatic question number extraction feature will be disabled.
## π How to Use
### Workflow Options
1. **PDF Workflow**:
- Upload a PDF document
- Each page is converted to an image
- Crop and enhance individual pages
- Enter question details
- Generate final PDF
2. **Image Workflow**:
- Upload multiple image files directly
- Crop and enhance individual images
- Enter question details
- Generate final PDF
### Step 1: Choose Input Method
- Select either PDF upload or multiple image upload from the main page
### Step 2: Crop & Enhance
- For each page/image, draw crop boxes around questions
- Use the sliders to adjust brightness, contrast, and gamma
- Save and continue to the next page/image
### Step 3: Enter Details
- Fill in metadata for each extracted question
- Use productivity features like "Same Subject for All"
- Extract question numbers automatically (if NVIDIA API is configured)
### Step 4: Generate & Download
- Choose PDF name and layout options
- Filter questions by status if needed
- Generate and download your final document
## π Project Structure
```
/
βββ uploads/ # Stores original user uploads (temporary)
βββ processed/ # Stores cropped & enhanced images (temporary)
βββ output/ # Stores the final generated PDFs
βββ templates/ # Contains all HTML files
βββ app.py # The main Flask application logic
βββ strings.py # Route constants and string definitions
βββ requirements.txt # List of Python dependencies
βββ README.md # This file
```
## π§ͺ Testing
Run the test suite to verify functionality:
```bash
python test.py
```
## π License
This project is licensed under the MIT License. |