Skip to content

CV- Handwritten Text extractor API, using HuggingFace OCR model by MicroSoft

License

Notifications You must be signed in to change notification settings

mihirdeo16/jubilant-barnacle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Computr-Vision Handwritten text extractor API

This application is based on hugginface library, in particular microsoft/trocr-base-handwritten.

Demo

Handwritten.Model.-.1.January.2022.mp4

API runs on the 10000 port and have the following endpoints:-

  • /isAlive - (get) To verify and check the API running successfullly. sample CURL command
curl -X 'GET' \
  'http://0.0.0.0:10000/isAlive' \
  -H 'accept: application/json'

sample output,

{
  "Message_code": 200,
  "Message": "Alive"
}
  • /extractor - (post) Upload the image to to extract the Image written text in and return. sample CURL command,
curl -X 'POST' \
  'http://0.0.0.0:10000/extractor' \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -F 'file=@sample.jpg;type=image/jpeg'

sample output

{
  "Message": "File is saved successfully",
  "data": "sample.jpg",
  "results": "Robert Crane"
}

Application is based on following python library stack-

To deploy the service -

Using docker,

docker build -t ocrExtractorImg .

And run the docker

docker run -p 10000:10000 --name ocrContinaer ocrExtractorImg

Optionally pre-build huggingface models could by volumn mounted

docker run -p 10000:10000 --name ocrContinaer -v <local_path>/models:/models ocrExtractorImg

To use in the local environment, following these steps:

  • Install requirements.txt
pip install -r requirements.txt
  • Run the server, *This will automatically create the two folder models and temp to which will automatically download the models from the hugginface.
python src/server.py

About

CV- Handwritten Text extractor API, using HuggingFace OCR model by MicroSoft

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published