From a31fb64f539453f462088aa15088bf99dbda580c Mon Sep 17 00:00:00 2001 From: SOULOFCINDER <841135647@qq.com> Date: Fri, 31 Mar 2023 14:53:31 +0800 Subject: [PATCH] update --- beit_base_patch16_224_pt22k_ft22k/Dockerfile | 25 +++++++++++++++ beit_base_patch16_224_pt22k_ft22k/app.py | 32 ++----------------- .../requirements.txt | 2 ++ 3 files changed, 29 insertions(+), 30 deletions(-) create mode 100644 beit_base_patch16_224_pt22k_ft22k/Dockerfile create mode 100644 beit_base_patch16_224_pt22k_ft22k/requirements.txt diff --git a/beit_base_patch16_224_pt22k_ft22k/Dockerfile b/beit_base_patch16_224_pt22k_ft22k/Dockerfile new file mode 100644 index 0000000..d525920 --- /dev/null +++ b/beit_base_patch16_224_pt22k_ft22k/Dockerfile @@ -0,0 +1,25 @@ +# please visit https://github.com/xfyun/aiges/releases to get stable and suitable iamges. + +FROM docker.io/library/python:3.8.9 + + +RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list +RUN sed -i 's|security.debian.org/debian-security|mirrors.ustc.edu.cn/debian-security|g' /etc/apt/sources.list + + +WORKDIR /home/user/app +RUN useradd -m -u 1000 user +RUN chown -R 1000.1000 /home/user + + +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 + + +CMD ["python3", "app.py"] \ No newline at end of file diff --git a/beit_base_patch16_224_pt22k_ft22k/app.py b/beit_base_patch16_224_pt22k_ft22k/app.py index 4a04b62..0e1db1c 100644 --- a/beit_base_patch16_224_pt22k_ft22k/app.py +++ b/beit_base_patch16_224_pt22k_ft22k/app.py @@ -1,5 +1,4 @@ import gradio as gr -from PIL import Image from transformers import BeitImageProcessor, BeitForImageClassification @@ -18,10 +17,11 @@ def inference(img): return model.config.id2label[predicted_class_idx] + title = "Image classification:beit-base-patch16-224-pt22k-ft22k" description = "Gradio Demo for beit-base-patch16-224-pt22k-ft22k. To use it, simply upload your image, or click one of the examples to load them." article = "