https://github.com/alivx/ocr-fastapi-demo
Demo app for sync and asyncio using fastAPI
https://github.com/alivx/ocr-fastapi-demo
async fastapi fastapi-crud redis rq synchronization
Last synced: 4 months ago
JSON representation
Demo app for sync and asyncio using fastAPI
- Host: GitHub
- URL: https://github.com/alivx/ocr-fastapi-demo
- Owner: alivx
- License: apache-2.0
- Created: 2022-11-28T02:07:10.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-05-10T14:08:18.000Z (over 1 year ago)
- Last Synced: 2025-07-19T07:36:58.823Z (4 months ago)
- Topics: async, fastapi, fastapi-crud, redis, rq, synchronization
- Language: Python
- Homepage:
- Size: 104 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OCR Service
testing OCR API using FastAPI to demonstrate asyncio, async, and queueing
### Dependencies
1. Docker
2. Docker-compose
### AsyncIO
Using:
1. aiofile
2. aiopytesseract
3. miniopy_async
https://github.com/alivx/ocr-fastapi-demo/blob/master

### Sync
1. pytesseract

### AsyncIO with queue
Using:
1. aiofile
2. aiopytesseract
3. miniopy_async
4. RQ
### Start the service
```
docker-compose build
docker-compose up
```
### API request
Sync
```
curl --location --request POST 'http://127.0.0.1:8000/upload' \
--form 'image=@"/${path}.png"'
```
AsyncIO
```
curl --location --request POST 'http://127.0.0.1:8001s/upload' \
--form 'image=@"/${path}.png"'
```
AsyncIO with queue
```
curl --location --request POST 'http://127.0.0.1:8002/upload' \
--form 'image=@"/${path}.png"'
```
### Stress test
```
locust -f stress.py
```