- The core code comes from:https://modelscope.cn/headlines/article/42
- Resolve dependency package conflicts
- Provide a simple HTTP API
- Run OCR API service
conda create -n ocr python=3.11
conda activate ocr
pip install -r requirements.txt
python main.py
- Call OCR API on the client, for example:
import requests
def ocr(image_path):
files = {'file': open(image_path, 'rb')}
response = requests.post(f'http://localhost:7700/api/ocr', files=files)
if response.status_code == 200:
response_json = response.json()
text = response_json["data"]
return text
return None
if __name__ == '__main__':
text = ocr('/Users/valdanito/Downloads/test222.jpg')
print(text)