Spaces:
Running
Running
Jagrut Thakare
commited on
Commit
·
bd73b6b
1
Parent(s):
ba58b0f
v9
Browse files- Dockerfile +6 -2
- app.py +12 -10
- requirements.txt +12 -6
Dockerfile
CHANGED
@@ -24,11 +24,15 @@ RUN useradd -m -u 1000 user && \
|
|
24 |
USER user
|
25 |
WORKDIR /home/user/app
|
26 |
|
|
|
27 |
# Copy files and install only Gradio
|
28 |
COPY --chown=user:user . /home/user/app
|
29 |
-
RUN pip install --user pydantic==2.8.2 gradio
|
30 |
|
31 |
-
RUN pip install --user
|
|
|
|
|
|
|
|
|
32 |
|
33 |
EXPOSE 7860
|
34 |
CMD ["python", "app.py"]
|
|
|
24 |
USER user
|
25 |
WORKDIR /home/user/app
|
26 |
|
27 |
+
|
28 |
# Copy files and install only Gradio
|
29 |
COPY --chown=user:user . /home/user/app
|
|
|
30 |
|
31 |
+
RUN pip install --user --no-cache-dir -r requirements.txt
|
32 |
+
|
33 |
+
COPY download_models.sh .
|
34 |
+
RUN chmod +x download_models.sh
|
35 |
+
RUN ./download_models.sh
|
36 |
|
37 |
EXPOSE 7860
|
38 |
CMD ["python", "app.py"]
|
app.py
CHANGED
@@ -3,22 +3,24 @@ import gradio as gr
|
|
3 |
import argparse
|
4 |
import cv2
|
5 |
import time
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
def setup_dependancies():
|
7 |
if not os.path.exists("./download_models.sh"):
|
8 |
print("Error: download_models.sh script not found.")
|
9 |
sys.exit(1)
|
10 |
|
11 |
subprocess.run(["./download_models.sh"])
|
12 |
-
|
13 |
-
pkg_dir = os.path.expanduser("~/.local/gpu_packages")
|
14 |
-
os.makedirs(pkg_dir, exist_ok=True)
|
15 |
-
# subprocess.run([
|
16 |
-
# sys.executable, "-m", "pip", "install",
|
17 |
-
# "--upgrade", "--target", pkg_dir,
|
18 |
-
# "torch", "torchvision", "torchaudio",
|
19 |
-
# "--extra-index-url", "https://download.pytorch.org/whl/cu118", "mxnet-cu112", "onnxruntime-gpu==1.12", "Cython", "insightface==0.2.1", "kornia==0.5.4", "dill", "numpy"
|
20 |
-
# ], check=True)
|
21 |
-
sys.path.insert(0, pkg_dir)
|
22 |
|
23 |
def init_models(args):
|
24 |
|
|
|
3 |
import argparse
|
4 |
import cv2
|
5 |
import time
|
6 |
+
import os
|
7 |
+
from utils.inference.image_processing import crop_face, get_final_image
|
8 |
+
from utils.inference.video_processing import read_video, get_target, get_final_video, add_audio_from_another_video, face_enhancement
|
9 |
+
from utils.inference.core import model_inference
|
10 |
+
from network.AEI_Net import AEI_Net
|
11 |
+
from coordinate_reg.image_infer import Handler
|
12 |
+
from insightface_func.face_detect_crop_multi import Face_detect_crop
|
13 |
+
from arcface_model.iresnet import iresnet100 # type: ignore[import-untyped]
|
14 |
+
from models.pix2pix_model import Pix2PixModel
|
15 |
+
from models.config_sr import TestOptions
|
16 |
+
|
17 |
def setup_dependancies():
|
18 |
if not os.path.exists("./download_models.sh"):
|
19 |
print("Error: download_models.sh script not found.")
|
20 |
sys.exit(1)
|
21 |
|
22 |
subprocess.run(["./download_models.sh"])
|
23 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
def init_models(args):
|
26 |
|
requirements.txt
CHANGED
@@ -1,10 +1,16 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
onnx
|
3 |
-
onnxruntime-gpu==1.12
|
4 |
-
|
|
|
|
|
|
|
5 |
scikit-image
|
6 |
-
insightface==0.2.1
|
7 |
requests==2.25.1
|
8 |
-
kornia==0.5.4
|
9 |
-
dill
|
10 |
wandb
|
|
|
1 |
+
torch
|
2 |
+
torchvision
|
3 |
+
torchaudio
|
4 |
+
--index-url https://download.pytorch.org/whl/cu118
|
5 |
+
pydantic==2.8.2
|
6 |
+
gradio
|
7 |
+
mxnet-cu112
|
8 |
onnx
|
9 |
+
onnxruntime-gpu==1.12
|
10 |
+
Cython
|
11 |
+
insightface==0.2.1
|
12 |
+
kornia==0.5.4 dill
|
13 |
+
opencv-python
|
14 |
scikit-image
|
|
|
15 |
requests==2.25.1
|
|
|
|
|
16 |
wandb
|