From 4d160a9aaef280410f3bf68973a20d3d2dfef765 Mon Sep 17 00:00:00 2001 From: SOULOFCINDER <841135647@qq.com> Date: Thu, 6 Apr 2023 16:57:21 +0800 Subject: [PATCH] update --- trocr_small_handwritten/Dockerfile | 10 +++++++++- trocr_small_handwritten/app.py | 4 ++-- trocr_small_handwritten/packages.txt | 2 ++ trocr_small_handwritten/requirements.txt | 1 + trocr_small_handwritten/trocr-small-handwritten | 1 - 5 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 trocr_small_handwritten/packages.txt delete mode 160000 trocr_small_handwritten/trocr-small-handwritten diff --git a/trocr_small_handwritten/Dockerfile b/trocr_small_handwritten/Dockerfile index a853b01..8883b34 100644 --- a/trocr_small_handwritten/Dockerfile +++ b/trocr_small_handwritten/Dockerfile @@ -2,6 +2,11 @@ FROM public.ecr.aws/iflytek-open/cuda-go-python-base:11.6-1.17-3.9.13-ubuntu1804 +RUN sed -i 's@//.*archive.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list +RUN sed -i 's/security.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list + +RUN --mount=target=/root/packages.txt,source=packages.txt apt-get update && xargs -r -a /root/packages.txt apt-get install -y && rm -rf /var/lib/apt/lists/* + WORKDIR /home/user/app RUN useradd -m -u 1000 user RUN chown -R 1000.1000 /home/user @@ -13,8 +18,11 @@ RUN pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple/ RUN pip install --no-cache-dir pip==22.3.1 RUN --mount=target=requirements.txt,source=requirements.txt pip install --no-cache-dir -r requirements.txt - COPY --chown=1000 ./ /home/user/app +RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash +RUN apt-get install git-lfs +RUN git lfs install +RUN git clone http://172.16.59.16:3000/microsoft/trocr-small-handwritten.git CMD ["python3", "app.py"] \ No newline at end of file diff --git a/trocr_small_handwritten/app.py b/trocr_small_handwritten/app.py index b2f3652..03d275f 100644 --- a/trocr_small_handwritten/app.py +++ b/trocr_small_handwritten/app.py @@ -15,7 +15,7 @@ def inference(img): print(generated_text) title = "OCR:trocr-small-handwritten" -description = "Gradio Demo for trocr-small-handwritten. To use it, simply upload your image, or click one of the examples to load them." +description = "这是trocr-small-handwritten的Gradio Demo。上传你想要的图像或者点击下面的示例来加载它。" article = "

Github Repo Pytorch

visitor badge

" examples=[['ocr_example.jpg']] @@ -29,4 +29,4 @@ demo = gr.Interface( article=article, examples=examples) -demo.launch() \ No newline at end of file +demo.launch(server_name="0.0.0.0") \ No newline at end of file diff --git a/trocr_small_handwritten/packages.txt b/trocr_small_handwritten/packages.txt new file mode 100644 index 0000000..b399c93 --- /dev/null +++ b/trocr_small_handwritten/packages.txt @@ -0,0 +1,2 @@ +git +curl \ No newline at end of file diff --git a/trocr_small_handwritten/requirements.txt b/trocr_small_handwritten/requirements.txt index 973b15c..5e5bf22 100644 --- a/trocr_small_handwritten/requirements.txt +++ b/trocr_small_handwritten/requirements.txt @@ -1,2 +1,3 @@ gradio==3.21.0 transformers==4.27.1 +torch==2.0.0 \ No newline at end of file diff --git a/trocr_small_handwritten/trocr-small-handwritten b/trocr_small_handwritten/trocr-small-handwritten deleted file mode 160000 index 55eb201..0000000 --- a/trocr_small_handwritten/trocr-small-handwritten +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 55eb2010aeaaa246defc329d42939e0253d55c99