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
|
Download RUN_PROJECT_GUIDE.md from mrrobot2610/IDP-Machine-learning: direct link, hf CLI and curl.
- Browser
- Download file 3.81 kB
-
https://huggingface.co/mrrobot2610/IDP-Machine-learning/resolve/main/RUN_PROJECT_GUIDE.md
- Command line
-
hf download hf://mrrobot2610/IDP-Machine-learning/RUN_PROJECT_GUIDE.md
-
curl -L -o RUN_PROJECT_GUIDE.md https://huggingface.co/mrrobot2610/IDP-Machine-learning/resolve/main/RUN_PROJECT_GUIDE.md
3.81 kB
| # 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 | |