Spaces:
Sleeping
Sleeping
Add HF Spaces metadata to README
Browse files
README.md
CHANGED
|
@@ -1,90 +1,12 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
```bash
|
| 14 |
-
.\venv\Scripts\activate
|
| 15 |
-
```
|
| 16 |
-
3. Install dependencies:
|
| 17 |
-
```bash
|
| 18 |
-
pip install -r requirements.txt
|
| 19 |
-
```
|
| 20 |
-
4. **For Tesseract OCR:** Install Tesseract on your system. Download from [Tesseract GitHub](https://github.com/tesseract-ocr/tesseract).
|
| 21 |
-
* If `pytesseract` can't find Tesseract, you might need to set the path in `app.py`:
|
| 22 |
-
```python
|
| 23 |
-
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'
|
| 24 |
-
```
|
| 25 |
-
5. **For PDF processing:** Install Poppler. Download from [Poppler for Windows](https://github.com/oschwartz10612/poppler-windows/releases).
|
| 26 |
-
* You will need to update the `poppler_path` in `app.py` to point to the `bin` directory of your Poppler installation (e.g., `r'C:\Program Files\poppler-0.68.0\bin'`)
|
| 27 |
-
|
| 28 |
-
## Run
|
| 29 |
-
|
| 30 |
-
```bash
|
| 31 |
-
python app.py
|
| 32 |
-
```
|
| 33 |
-
|
| 34 |
-
API will be at `http://127.0.0.1:5000`.
|
| 35 |
-
|
| 36 |
-
## API Endpoints
|
| 37 |
-
|
| 38 |
-
### `POST /easyocr`
|
| 39 |
-
|
| 40 |
-
Uses EasyOCR to extract text from images.
|
| 41 |
-
|
| 42 |
-
**Request:** `multipart/form-data` with `images` (one or more image files).
|
| 43 |
-
|
| 44 |
-
**Example (curl):**
|
| 45 |
-
|
| 46 |
-
```bash
|
| 47 |
-
curl -X POST -F "images=@/path/to/your/image1.png" http://127.0.0.1:5000/easyocr
|
| 48 |
-
```
|
| 49 |
-
|
| 50 |
-
### `POST /tesseract`
|
| 51 |
-
|
| 52 |
-
Uses Tesseract OCR to extract text from images.
|
| 53 |
-
|
| 54 |
-
**Request:** `multipart/form-data` with `images` (one or more image files).
|
| 55 |
-
|
| 56 |
-
**Example (curl):**
|
| 57 |
-
|
| 58 |
-
```bash
|
| 59 |
-
curl -X POST -F "images=@/path/to/your/image1.png" http://127.0.0.1:5000/tesseract
|
| 60 |
-
```
|
| 61 |
-
|
| 62 |
-
### `POST /process_question_paper`
|
| 63 |
-
|
| 64 |
-
Processes an image or PDF of a question paper to extract questions and answers.
|
| 65 |
-
|
| 66 |
-
**Request:** `multipart/form-data` with `file` (a single image or PDF file).
|
| 67 |
-
|
| 68 |
-
**Example (curl for image):**
|
| 69 |
-
|
| 70 |
-
```bash
|
| 71 |
-
curl -X POST -F "file=@/path/to/your/question_paper.png" http://127.0.0.1:5000/process_question_paper
|
| 72 |
-
```
|
| 73 |
-
|
| 74 |
-
**Example (curl for PDF):**
|
| 75 |
-
|
| 76 |
-
```bash
|
| 77 |
-
curl -X POST -F "file=@/path/to/your/question_paper.pdf" http://127.0.0.1:5000/process_question_paper
|
| 78 |
-
```
|
| 79 |
-
|
| 80 |
-
### `GET /evaluate_answers`
|
| 81 |
-
|
| 82 |
-
Compares OCR extracted texts with the answers from the last processed question paper.
|
| 83 |
-
|
| 84 |
-
**Request:** None (GET request).
|
| 85 |
-
|
| 86 |
-
**Example (curl):**
|
| 87 |
-
|
| 88 |
-
```bash
|
| 89 |
-
curl -X GET http://127.0.0.1:5000/evaluate_answers
|
| 90 |
-
```
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: OCR OMR Backend
|
| 3 |
+
emoji: 📝
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: green
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_port: 7860
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# OCR/OMR Backend API
|
| 11 |
+
|
| 12 |
+
Flask backend for OCR and OMR processing.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|