Document Question Answering
Transformers
PyTorch
English
document-processing
ocr
ner
text-classification
information-extraction
invoice
receipt
form
Instructions to use mrrobot2610/IDP-Machine-learning with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mrrobot2610/IDP-Machine-learning with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("document-question-answering", model="mrrobot2610/IDP-Machine-learning")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("mrrobot2610/IDP-Machine-learning", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 3,811 Bytes
1a7ee60 | 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 175 | # IDP Project Runner Guide
## Quick Start
The easiest way to run the entire IDP system (both backend and frontend):
```bash
python run_project.py
```
This will:
1. β Check all prerequisites (Python, Node.js, dependencies)
2. β Start the FastAPI backend server on port 7860
3. β Start the Next.js frontend server on port 3000
4. β Monitor both processes and display their output
5. β Handle graceful shutdown with Ctrl+C
## Usage Options
### Run Both Services (Default)
```bash
python run_project.py
```
- Backend: http://localhost:7860
- Frontend: http://localhost:3000
### Run Backend Only
```bash
python run_project.py --backend-only
```
Useful for API testing or when using a different frontend.
### Run Frontend Only
```bash
python run_project.py --frontend-only
```
Useful when backend is already running or deployed elsewhere.
### Custom Ports
```bash
python run_project.py --port-backend 8000 --port-frontend 3001
```
### Skip Prerequisite Checks
```bash
python run_project.py --no-check
```
Useful for faster startup when you know everything is installed.
### View All Options
```bash
python run_project.py --help
```
## What Gets Checked
The script automatically verifies:
- β Python 3.10+ installed
- β Node.js 18+ installed (if running frontend)
- β npm installed (if running frontend)
- β FastAPI installed
- β PyTorch installed
- β Frontend dependencies (`node_modules`)
## Environment Variables
The script automatically sets these for the backend:
- `KMP_DUPLICATE_LIB_OK=TRUE`
- `OMP_NUM_THREADS=1`
- `OPENBLAS_NUM_THREADS=1`
- `MKL_NUM_THREADS=1`
- `VECLIB_MAXIMUM_THREADS=1`
- `NUMEXPR_NUM_THREADS=1`
- `TF_CPP_MIN_LOG_LEVEL=2`
These prevent threading conflicts and reduce log noise.
## Features
### Color-Coded Output
- π¦ **Blue** - Backend server logs
- π¦ **Cyan** - Frontend server logs
- π© **Green** - Success messages
- π¨ **Yellow** - Warnings
- π₯ **Red** - Errors
### Automatic Cleanup
- Filters out mutex warnings from backend
- Graceful shutdown of both services on Ctrl+C
- Timeout handling if processes don't respond
### Process Monitoring
- Detects if either service crashes
- Shows real-time output from both services
- Restarts are needed if a service dies
## Troubleshooting
### Backend won't start
```bash
# Check if dependencies are installed
pip install -r requirements.txt
# Check if port is already in use
lsof -i :7860
# Run backend only with verbose output
python run_project.py --backend-only
```
### Frontend won't start
```bash
# Install frontend dependencies
cd frontend
npm install
# Check if port is already in use
lsof -i :3000
# Run frontend only
python run_project.py --frontend-only
```
### Dependencies missing
```bash
# Backend dependencies
pip install -r requirements.txt
# Frontend dependencies
cd frontend && npm install
```
## Alternative Methods
### Using Shell Script (Backend Only)
```bash
./run_api_server.sh
```
### Manual Start
```bash
# Terminal 1 - Backend
python api_server.py
# Terminal 2 - Frontend
cd frontend && npm run dev
```
## Stopping the System
Press **Ctrl+C** once to trigger graceful shutdown. The script will:
1. Terminate backend process
2. Terminate frontend process
3. Wait up to 5 seconds for each
4. Force kill if needed
## Access Points
| Service | URL | Description |
|---------|-----|-------------|
| Frontend App | http://localhost:3000 | Main web interface |
| Backend API | http://localhost:7860 | REST API endpoint |
| API Documentation | http://localhost:7860/docs | Interactive API docs (Swagger) |
| Health Check | http://localhost:7860/health | System status |
## Production Deployment
For production, see:
- `deployment_guide.md` - Hugging Face Spaces deployment
- `PROJECT_DOCUMENTATION.md` - Complete system documentation
## License
MIT
|