Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: 1 day ago
JSON representation

Demo app for sync and asyncio using fastAPI

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

sample1

### Sync

1. pytesseract

sample1

### 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
```