Skip to content

Commit a7888ab

Browse files
authored
Refactor Animation based on ERAG (opea-project#1079)
Signed-off-by: Yao, Qing <qing.yao@intel.com>
1 parent f006a3e commit a7888ab

34 files changed

+110
-49
lines changed

.github/workflows/docker/compose/animation-compose.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
services:
66
animation:
77
build:
8-
dockerfile: comps/animation/wav2lip/Dockerfile
8+
dockerfile: comps/animation/src/Dockerfile
99
image: ${REGISTRY:-opea}/animation:${TAG:-latest}
1010
wav2lip:
1111
build:
12-
dockerfile: comps/animation/wav2lip/dependency/Dockerfile
12+
dockerfile: comps/animation/src/integration/dependency/Dockerfile
1313
image: ${REGISTRY:-opea}/wav2lip:${TAG:-latest}
1414
wav2lip-gaudi:
1515
build:
16-
dockerfile: comps/animation/wav2lip/dependency/Dockerfile.intel_hpu
16+
dockerfile: comps/animation/src/integration/dependency/Dockerfile.intel_hpu
1717
image: ${REGISTRY:-opea}/wav2lip-gaudi:${TAG:-latest}

comps/animation/wav2lip/Dockerfile renamed to comps/animation/src/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ ARG ARCH=cpu
1515
COPY comps /home/user/comps
1616

1717
RUN pip install --no-cache-dir --upgrade pip && \
18-
pip install --no-cache-dir -r /home/user/comps/animation/wav2lip/requirements.txt ;
18+
pip install --no-cache-dir -r /home/user/comps/animation/src/requirements.txt ;
1919

2020
ENV PYTHONPATH=$PYTHONPATH:/home/user
2121

22-
WORKDIR /home/user/comps/animation/wav2lip
22+
WORKDIR /home/user/comps/animation/src
2323

24-
ENTRYPOINT ["python3", "animation.py"]
24+
ENTRYPOINT ["python3", "opea_animation_microservice.py"]

comps/animation/wav2lip/README.md renamed to comps/animation/src/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ cd GenAIComps
1616
- Xeon CPU
1717

1818
```bash
19-
docker build -t opea/wav2lip:latest -f comps/animation/wav2lip/dependency/Dockerfile .
19+
docker build -t opea/wav2lip:latest -f comps/animation/src/integration/dependency/Dockerfile .
2020
```
2121

2222
- Gaudi2 HPU
2323

2424
```bash
25-
docker build -t opea/wav2lip-gaudi:latest -f comps/animation/wav2lip/dependency/Dockerfile.intel_hpu .
25+
docker build -t opea/wav2lip-gaudi:latest -f comps/animation/src/integration/dependency/Dockerfile.intel_hpu .
2626
```
2727

2828
### 1.1.2 Animation server image
2929

3030
```bash
31-
docker build -t opea/animation:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/animation/wav2lip/Dockerfile .
31+
docker build -t opea/animation:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/animation/src/Dockerfile .
3232
```
3333

3434
## 1.2. Set environment variables
@@ -78,13 +78,13 @@ export FPS=10
7878
- Xeon CPU
7979

8080
```bash
81-
docker run --privileged -d --name "wav2lip-service" -p 7860:7860 --ipc=host -w /home/user/comps/animation/wav2lip -e PYTHON=/usr/bin/python3.11 -v $(pwd)/comps/animation/wav2lip/assets:/home/user/comps/animation/wav2lip/assets -e DEVICE=$DEVICE -e INFERENCE_MODE=$INFERENCE_MODE -e CHECKPOINT_PATH=$CHECKPOINT_PATH -e FACE=$FACE -e AUDIO=$AUDIO -e FACESIZE=$FACESIZE -e OUTFILE=$OUTFILE -e GFPGAN_MODEL_VERSION=$GFPGAN_MODEL_VERSION -e UPSCALE_FACTOR=$UPSCALE_FACTOR -e FPS=$FPS -e WAV2LIP_PORT=$WAV2LIP_PORT opea/wav2lip:latest
81+
docker run --privileged -d --name "wav2lip-service" -p 7860:7860 --ipc=host -w /home/user/comps/animation/src -e PYTHON=/usr/bin/python3.11 -v $(pwd)/comps/animation/src/assets:/home/user/comps/animation/src/assets -e DEVICE=$DEVICE -e INFERENCE_MODE=$INFERENCE_MODE -e CHECKPOINT_PATH=$CHECKPOINT_PATH -e FACE=$FACE -e AUDIO=$AUDIO -e FACESIZE=$FACESIZE -e OUTFILE=$OUTFILE -e GFPGAN_MODEL_VERSION=$GFPGAN_MODEL_VERSION -e UPSCALE_FACTOR=$UPSCALE_FACTOR -e FPS=$FPS -e WAV2LIP_PORT=$WAV2LIP_PORT opea/wav2lip:latest
8282
```
8383

8484
- Gaudi2 HPU
8585

8686
```bash
87-
docker run --privileged -d --name "wav2lip-gaudi-service" -p 7860:7860 --runtime=habana --cap-add=sys_nice --ipc=host -w /home/user/comps/animation/wav2lip -v $(pwd)/comps/animation/wav2lip/assets:/home/user/comps/animation/wav2lip/assets -e HABANA_VISIBLE_DEVICES=all -e OMPI_MCA_btl_vader_single_copy_mechanism=none -e PYTHON=/usr/bin/python3.10 -e DEVICE=$DEVICE -e INFERENCE_MODE=$INFERENCE_MODE -e CHECKPOINT_PATH=$CHECKPOINT_PATH -e FACE=$FACE -e AUDIO=$AUDIO -e FACESIZE=$FACESIZE -e OUTFILE=$OUTFILE -e GFPGAN_MODEL_VERSION=$GFPGAN_MODEL_VERSION -e UPSCALE_FACTOR=$UPSCALE_FACTOR -e FPS=$FPS -e WAV2LIP_PORT=$WAV2LIP_PORT opea/wav2lip-gaudi:latest
87+
docker run --privileged -d --name "wav2lip-gaudi-service" -p 7860:7860 --runtime=habana --cap-add=sys_nice --ipc=host -w /home/user/comps/animation/src -v $(pwd)/comps/animation/src/assets:/home/user/comps/animation/src/assets -e HABANA_VISIBLE_DEVICES=all -e OMPI_MCA_btl_vader_single_copy_mechanism=none -e PYTHON=/usr/bin/python3.10 -e DEVICE=$DEVICE -e INFERENCE_MODE=$INFERENCE_MODE -e CHECKPOINT_PATH=$CHECKPOINT_PATH -e FACE=$FACE -e AUDIO=$AUDIO -e FACESIZE=$FACESIZE -e OUTFILE=$OUTFILE -e GFPGAN_MODEL_VERSION=$GFPGAN_MODEL_VERSION -e UPSCALE_FACTOR=$UPSCALE_FACTOR -e FPS=$FPS -e WAV2LIP_PORT=$WAV2LIP_PORT opea/wav2lip-gaudi:latest
8888
```
8989

9090
## 2.2 Run Animation Microservice
@@ -101,28 +101,28 @@ Once microservice starts, user can use below script to validate the running micr
101101

102102
```bash
103103
cd GenAIComps
104-
python3 comps/animation/wav2lip/dependency/check_wav2lip_server.py
104+
python3 comps/animation/src/integration/dependency/check_wav2lip_server.py
105105
```
106106

107107
## 3.2 Validate Animation service
108108

109109
```bash
110110
cd GenAIComps
111111
export ip_address=$(hostname -I | awk '{print $1}')
112-
curl http://${ip_address}:9066/v1/animation -X POST -H "Content-Type: application/json" -d @comps/animation/wav2lip/assets/audio/sample_question.json
112+
curl http://${ip_address}:9066/v1/animation -X POST -H "Content-Type: application/json" -d @comps/animation/src/assets/audio/sample_question.json
113113
```
114114

115115
or
116116

117117
```bash
118118
cd GenAIComps
119-
python3 comps/animation/wav2lip/dependency/check_animation_server.py
119+
python3 comps/animation/src/integration/dependency/check_animation_server.py
120120
```
121121

122122
The expected output will be a message similar to the following:
123123

124124
```bash
125-
{'wav2lip_result': '....../GenAIComps/comps/animation/wav2lip/assets/outputs/result.mp4'}
125+
{'wav2lip_result': '....../GenAIComps/comps/animation/src/assets/outputs/result.mp4'}
126126
```
127127

128-
Please find "comps/animation/wav2lip/assets/outputs/result.mp4" as a reference generated video.
128+
Please find "comps/animation/src/assets/outputs/result.mp4" as a reference generated video.

0 commit comments

Comments
 (0)