mirror of
https://github.com/sml2h3/ocr_api_server.git
synced 2025-05-03 18:10:06 +08:00
Merge 7ead30c81b
into 7f37543ffb
This commit is contained in:
commit
0975264f5c
21
Dockerfile
21
Dockerfile
@ -1,17 +1,18 @@
|
||||
# 使用python:3.8-slim-buster作为基础镜像
|
||||
FROM python:3.8-slim-buster
|
||||
|
||||
# 创建app目录来存储我们的代码
|
||||
RUN mkdir /app
|
||||
|
||||
COPY ./*.txt ./*.py ./*.sh ./*.onnx /app/
|
||||
|
||||
|
||||
RUN cd /app \
|
||||
&& python3 -m pip install --upgrade pip -i https://pypi.douban.com/simple/\
|
||||
&& pip3 install --no-cache-dir -r requirements.txt --extra-index-url https://pypi.douban.com/simple/ \
|
||||
&& rm -rf /tmp/* && rm -rf /root/.cache/* \
|
||||
&& sed -i 's#http://deb.debian.org#http://mirrors.aliyun.com/#g' /etc/apt/sources.list\
|
||||
&& apt-get --allow-releaseinfo-change update && apt install libgl1-mesa-glx libglib2.0-0 -y
|
||||
|
||||
# 将工作目录设置为/app,这意味着后续的指令都在/app下执行
|
||||
WORKDIR /app
|
||||
|
||||
# 将当前目录(即你的项目目录)下的所有文件和文件夹复制到镜像的/app目录下
|
||||
COPY . /app
|
||||
|
||||
# 安装Python依赖
|
||||
RUN pip3 install --no-cache-dir requirements.txt
|
||||
|
||||
|
||||
# 定义容器启动时要运行的命令
|
||||
CMD ["python3", "ocr_server.py", "--port", "9898", "--ocr", "--det"]
|
||||
|
@ -5,6 +5,10 @@ import json
|
||||
|
||||
import ddddocr
|
||||
from flask import Flask, request
|
||||
from flask_cors import CORS
|
||||
|
||||
app = Flask(__name__)
|
||||
CORS(app, origins=["http://example.com"])
|
||||
|
||||
parser = argparse.ArgumentParser(description="使用ddddocr搭建的最简api服务")
|
||||
parser.add_argument("-p", "--port", type=int, default=9898)
|
||||
|
@ -1,2 +1,3 @@
|
||||
ddddocr>=1.3.1
|
||||
flask
|
||||
ddddocr
|
||||
flask
|
||||
flask-cors
|
||||
|
Loading…
Reference in New Issue
Block a user