-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ye, Xinyu <[email protected]>
- Loading branch information
1 parent
0919145
commit 209aea7
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/bin/bash | ||
# Copyright (C) 2024 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set -x | ||
|
||
WORKPATH=$(dirname "$PWD") | ||
ip_address=$(hostname -I | awk '{print $1}') | ||
|
||
function build_docker_images() { | ||
cd $WORKPATH | ||
echo $(pwd) | ||
docker build --no-cache -t opea/svd:latest -f comps/image2video/svd/Dockerfile . | ||
if [ $? -ne 0 ]; then | ||
echo "opea/svd built fail" | ||
exit 1 | ||
else | ||
echo "opea/svd built successful" | ||
fi | ||
docker build --no-cache -t opea/image2video:latest -f comps/image2video/Dockerfile . | ||
if [ $? -ne 0 ]; then | ||
echo "opea/image2video built fail" | ||
exit 1 | ||
else | ||
echo "opea/image2video built successful" | ||
fi | ||
} | ||
|
||
function start_service() { | ||
unset http_proxy | ||
docker run -d --name="test-comps-image2video-svd" -e http_proxy=$http_proxy -e https_proxy=$https_proxy -p 9368:9368 --ipc=host opea/svd:latest | ||
docker run -d --name="test-comps-image2video" -e SVD_ENDPOINT=http://$ip_address:9368 -e http_proxy=$http_proxy -e https_proxy=$https_proxy -p 9369:9369 --ipc=host opea/image2video:latest | ||
sleep 3m | ||
} | ||
|
||
function validate_microservice() { | ||
result=$(http_proxy="" curl http://localhost:9369/v1/image2video -XPOST -d '{"images_path":[{"image_path":"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/svd/rocket.png"}]}' -H 'Content-Type: application/json') | ||
if [[ $result == *"generated.mp4"* ]]; then | ||
echo "Result correct." | ||
else | ||
echo "Result wrong." | ||
docker logs test-comps-tts-speecht5 | ||
docker logs test-comps-tts | ||
exit 1 | ||
fi | ||
|
||
} | ||
|
||
function stop_docker() { | ||
cid=$(docker ps -aq --filter "name=test-comps-image2video*") | ||
if [[ ! -z "$cid" ]]; then docker stop $cid && docker rm $cid && sleep 1s; fi | ||
} | ||
|
||
function main() { | ||
|
||
stop_docker | ||
|
||
build_docker_images | ||
start_service | ||
|
||
validate_microservice | ||
|
||
stop_docker | ||
echo y | docker system prune | ||
|
||
} | ||
|
||
main |