Esmaill1 commited on
Commit ·
6cb1419
1
Parent(s): 2a534d2
Add Docker and Hugging Face deployment files
Browse files- .dockerignore +15 -0
- Dockerfile +38 -0
- app.py +6 -0
- requirements.txt +2 -1
.dockerignore
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.git
|
| 2 |
+
.gitignore
|
| 3 |
+
__pycache__
|
| 4 |
+
*.pyc
|
| 5 |
+
*.pyo
|
| 6 |
+
*.pyd
|
| 7 |
+
.DS_Store
|
| 8 |
+
weights/
|
| 9 |
+
results/
|
| 10 |
+
inputs/cropped_faces/
|
| 11 |
+
inputs/gray_faces/
|
| 12 |
+
inputs/masked_faces/
|
| 13 |
+
inputs/whole_imgs/
|
| 14 |
+
output/
|
| 15 |
+
web-demos/
|
Dockerfile
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM pytorch/pytorch:1.13.1-cuda11.6-cudnn8-runtime
|
| 2 |
+
|
| 3 |
+
WORKDIR /code
|
| 4 |
+
|
| 5 |
+
# Install system dependencies
|
| 6 |
+
RUN apt-get update && apt-get install -y \
|
| 7 |
+
libgl1 \
|
| 8 |
+
libglib2.0-0 \
|
| 9 |
+
git \
|
| 10 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
+
|
| 12 |
+
# Copy requirements
|
| 13 |
+
COPY requirements.txt .
|
| 14 |
+
|
| 15 |
+
# Install python dependencies
|
| 16 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 17 |
+
|
| 18 |
+
# Copy application code
|
| 19 |
+
COPY . .
|
| 20 |
+
|
| 21 |
+
# Create necessary directories and set permissions
|
| 22 |
+
RUN mkdir -p weights inputs output && \
|
| 23 |
+
chmod 777 weights inputs output
|
| 24 |
+
|
| 25 |
+
# Install basicsr
|
| 26 |
+
RUN python setup.py install
|
| 27 |
+
|
| 28 |
+
# Create a non-root user and switch to it
|
| 29 |
+
RUN useradd -m -u 1000 user
|
| 30 |
+
USER user
|
| 31 |
+
ENV HOME=/home/user \
|
| 32 |
+
PATH=/home/user/.local/bin:$PATH
|
| 33 |
+
|
| 34 |
+
WORKDIR /code
|
| 35 |
+
|
| 36 |
+
EXPOSE 7860
|
| 37 |
+
|
| 38 |
+
CMD ["python", "app.py"]
|
app.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
" <a href="https://twitter.com/ShangchenZhou"><img style="margin-top:0.5em; margin-bottom:0.5em" src="https://img.shields.io/twitter/follow/ShangchenZhou?label=%40ShangchenZhou&style=social" alt="Twitter Follow"></a>
|
| 2 |
+
<a href="https://github.com/sczhou"><img style="margin-top:0.5em; margin-bottom:2em" src="https://img.shields.io/github/followers/sczhou?style=social" alt="Github Follow"></a>
|
| 3 |
+
</div>
|
| 4 |
+
|
| 5 |
+
<center><img src='https://visitor-badge-sczhou.glitch.me/badge?page_id=sczhou/CodeFormer' alt='visitors'></center>
|
| 6 |
+
"
|
requirements.txt
CHANGED
|
@@ -14,4 +14,5 @@ torchvision
|
|
| 14 |
tqdm
|
| 15 |
yapf
|
| 16 |
lpips
|
| 17 |
-
gdown
|
|
|
|
|
|
| 14 |
tqdm
|
| 15 |
yapf
|
| 16 |
lpips
|
| 17 |
+
gdown
|
| 18 |
+
gradio # supports downloading the large file from Google Drive
|