Skip to content

Commit 960805a

Browse files
ctao456rbrugaroZePan110kevinintelpre-commit-ci[bot]
authored
Adding audio and image/video files needed for loading the Gradio UI, and update the UI Python function (#1034)
Signed-off-by: Chun Tao <chun.tao@intel.com> Signed-off-by: rbrugaro <rita.brugarolas.brufau@intel.com> Signed-off-by: ZePan110 <ze.pan@intel.com> Signed-off-by: Louie Tsai <louie.tsai@intel.com> Signed-off-by: chen, suyue <suyue.chen@intel.com> Co-authored-by: rbrugaro <rita.brugarolas.brufau@intel.com> Co-authored-by: ZePan110 <ze.pan@intel.com> Co-authored-by: kevinintel <hanwen.chang@intel.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Louie Tsai <louie.tsai@intel.com> Co-authored-by: chen, suyue <suyue.chen@intel.com>
1 parent 002f0e2 commit 960805a

File tree

9 files changed

+382
-459
lines changed

9 files changed

+382
-459
lines changed

AvatarChatbot/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
*.log
55
docker_compose/intel/cpu/xeon/data
66
docker_compose/intel/hpu/gaudi/data
7+
inputs/
8+
outputs/

AvatarChatbot/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ The AvatarChatbot service can be deployed on either Intel Gaudi2 AI Accelerator
7575

7676
### Deploy AvatarChatbot on Gaudi
7777

78-
Refer to the [Gaudi Guide](./docker_compose/intel/hpu/gaudi/README.md) for instructions on deploying AvatarChatbot on Gaudi.
78+
Refer to the [Gaudi Guide](./docker_compose/intel/hpu/gaudi/README.md) for instructions on deploying AvatarChatbot on Gaudi, and on setting up an UI for the application.
7979

8080
### Deploy AvatarChatbot on Xeon
8181

AvatarChatbot/assets/img/UI.png

595 KB
Loading

AvatarChatbot/docker_compose/intel/cpu/xeon/README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ export ANIMATION_SERVICE_PORT=3008
9696
```bash
9797
export DEVICE="cpu"
9898
export WAV2LIP_PORT=7860
99-
export INFERENCE_MODE='wav2lip+gfpgan'
99+
export INFERENCE_MODE='wav2lip_only'
100100
export CHECKPOINT_PATH='/usr/local/lib/python3.11/site-packages/Wav2Lip/checkpoints/wav2lip_gan.pth'
101-
export FACE="assets/img/avatar5.png"
101+
export FACE="assets/img/avatar1.jpg"
102102
# export AUDIO='assets/audio/eg3_ref.wav' # audio file path is optional, will use base64str in the post request as input if is 'None'
103103
export AUDIO='None'
104104
export FACESIZE=96
@@ -188,13 +188,16 @@ The output file will be saved in the current working directory, as `${PWD}` is m
188188

189189
## Gradio UI
190190

191-
Follow the instructions in [Build Mega Service of AudioQnA on Gaudi](https://github.com/opea-project/GenAIExamples/blob/main/AudioQnA/docker_compose/intel/hpu/gaudi/README.md) to build necessary Docker images and start the AudioQnA MegaService with the endpoint `http://localhost:3008/v1/audioqna`. Then run the following command to start the Gradio UI:
192-
193191
```bash
194-
cd GenAIExamples/AvatarChatbot/docker/ui/gradio
195-
python3 app_gradio_demo.py
192+
cd $WORKPATH/GenAIExamples/AvatarChatbot
193+
python3 ui/gradio/app_gradio_demo_avatarchatbot.py
196194
```
197195

196+
The UI can be viewed at http://${host_ip}:7861
197+
<img src="../../../../assets/img/UI.png" alt="UI Example" width="60%">
198+
In the current version v1.0, you need to set the avatar figure image/video and the DL model choice in the environment variables before starting AvatarChatbot backend service and running the UI. Please just customize the audio question in the UI.
199+
\*\* We will enable change of avatar figure between runs in v2.0
200+
198201
## Troubleshooting
199202

200203
```bash

AvatarChatbot/docker_compose/intel/hpu/gaudi/README.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ export ANIMATION_SERVICE_PORT=3008
9696
```bash
9797
export DEVICE="hpu"
9898
export WAV2LIP_PORT=7860
99-
export INFERENCE_MODE='wav2lip+gfpgan'
99+
export INFERENCE_MODE='wav2lip_only'
100100
export CHECKPOINT_PATH='/usr/local/lib/python3.10/dist-packages/Wav2Lip/checkpoints/wav2lip_gan.pth'
101-
export FACE="assets/img/avatar5.png"
101+
export FACE="assets/img/avatar1.jpg"
102102
# export AUDIO='assets/audio/eg3_ref.wav' # audio file path is optional, will use base64str in the post request as input if is 'None'
103103
export AUDIO='None'
104104
export FACESIZE=96
@@ -188,14 +188,25 @@ The output file will be saved in the current working directory, as `${PWD}` is m
188188

189189
## Gradio UI
190190

191-
Follow the instructions in [Build Mega Service of AudioQnA on Gaudi](https://github.com/opea-project/GenAIExamples/blob/main/AudioQnA/docker_compose/intel/hpu/gaudi/README.md) to build necessary Docker images and start the AudioQnA MegaService with the endpoint `http://localhost:3008/v1/audioqna`. Then run the following command to start the Gradio UI:
191+
```bash
192+
sudo apt update
193+
sudo apt install -y yasm pkg-config libx264-dev nasm
194+
cd $WORKPATH
195+
git clone https://github.com/FFmpeg/FFmpeg.git
196+
cd FFmpeg
197+
sudo ./configure --enable-gpl --enable-libx264 && sudo make -j$(nproc-1) && sudo make install && hash -r
198+
pip install gradio==4.38.1 soundfile
199+
```
192200

193201
```bash
194-
cd GenAIExamples/AvatarChatbot/docker/ui/gradio
195-
python3 app_gradio_demo.py
202+
cd $WORKPATH/GenAIExamples/AvatarChatbot
203+
python3 ui/gradio/app_gradio_demo_avatarchatbot.py
196204
```
197205

198-
The UI can be viewed at http://${host_ip}:7861
206+
The UI can be viewed at http://${host_ip}:7861
207+
<img src="../../../../assets/img/UI.png" alt="UI Example" width="60%">
208+
In the current version v1.0, you need to set the avatar figure image/video and the DL model choice in the environment variables before starting AvatarChatbot backend service and running the UI. Please just customize the audio question in the UI.
209+
\*\* We will enable change of avatar figure between runs in v2.0
199210

200211
## Troubleshooting
201212

AvatarChatbot/tests/test_compose_on_gaudi.sh

100644100755
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,17 @@ function stop_docker() {
127127

128128

129129
function main() {
130-
131130
stop_docker
131+
echo y | docker builder prune --all
132+
echo y | docker image prune
133+
132134
if [[ "$IMAGE_REPO" == "opea" ]]; then build_docker_images; fi
133135
start_services
134136
# validate_microservices
135137
validate_megaservice
136138
# validate_frontend
137-
stop_docker
138139

140+
stop_docker
139141
echo y | docker builder prune --all
140142
echo y | docker image prune
141143

AvatarChatbot/tests/test_compose_on_xeon.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)