Spaces:
Running
Running
fix: docker 环境部署
Browse files- Dockerfile +6 -5
- app.py +15 -14
- packages.txt +0 -3
Dockerfile
CHANGED
@@ -1,6 +1,6 @@
|
|
|
|
1 |
FROM python:3.10
|
2 |
|
3 |
-
# FROM python:3.10-slim-bullseye
|
4 |
ENV CUDA_VISIBLE_DEVICES=-1
|
5 |
ARG PIP_NO_CACHE_DIR=1
|
6 |
|
@@ -16,9 +16,10 @@ RUN pip install paddleocr==2.7.0.3 \
|
|
16 |
&& pip uninstall -y opencv-python opencv-contrib-python \
|
17 |
&& pip install opencv-python-headless
|
18 |
|
19 |
-
RUN
|
20 |
-
|
21 |
-
|
22 |
-
WORKDIR /app
|
|
|
23 |
|
24 |
CMD ["python", "-u", "app.py"]
|
|
|
1 |
+
# https://huggingface.co/spaces/gaunernst/layoutlm-docvqa-paddleocr/blob/main/Dockerfile
|
2 |
FROM python:3.10
|
3 |
|
|
|
4 |
ENV CUDA_VISIBLE_DEVICES=-1
|
5 |
ARG PIP_NO_CACHE_DIR=1
|
6 |
|
|
|
16 |
&& pip uninstall -y opencv-python opencv-contrib-python \
|
17 |
&& pip install opencv-python-headless
|
18 |
|
19 |
+
RUN useradd -m -u 1000 user
|
20 |
+
USER user
|
21 |
+
ENV HOME=/home/user
|
22 |
+
WORKDIR $HOME/app
|
23 |
+
COPY --chown=user . $HOME/app
|
24 |
|
25 |
CMD ["python", "-u", "app.py"]
|
app.py
CHANGED
@@ -53,18 +53,19 @@ examples = [
|
|
53 |
|
54 |
css = ".output_image, .input_image {height: 40rem !important; width: 100% !important;}"
|
55 |
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
|
|
68 |
)
|
69 |
-
demo.queue(max_size=10)
|
70 |
-
demo.launch(debug=True,
|
|
|
53 |
|
54 |
css = ".output_image, .input_image {height: 40rem !important; width: 100% !important;}"
|
55 |
|
56 |
+
if __name__ == '__main__':
|
57 |
+
demo = gr.Interface(
|
58 |
+
inference,
|
59 |
+
[gr.Image(type='pil', label='Input'),
|
60 |
+
gr.Dropdown(choices=['ch', 'en', 'fr', 'german', 'korean', 'japan'], value='ch', label='language'),
|
61 |
+
gr.Slider(0.1, 1, 0.5, step=0.1, label='confidence_threshold')
|
62 |
+
],
|
63 |
+
# 输出
|
64 |
+
[gr.Image(type='pil', label='Output'), gr.Dataframe(headers=[ 'bbox', 'score', 'text'], label='Result')],
|
65 |
+
title=title,
|
66 |
+
description=description,
|
67 |
+
examples=examples,
|
68 |
+
css=css,
|
69 |
)
|
70 |
+
demo.queue(max_size=10)
|
71 |
+
demo.launch(debug=True, server_name="0.0.0.0")
|
packages.txt
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
ffmpeg
|
2 |
-
libsm6
|
3 |
-
libxext6
|
|
|
|
|
|
|
|