forked from WDAqua/Qanary-question-answering-components
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add fastapi support to MBart component
- Loading branch information
Showing
4 changed files
with
80 additions
and
34 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 |
---|---|---|
@@ -1,17 +1,34 @@ | ||
#!/bin/sh | ||
export $(grep -v "^#" < .env) | ||
|
||
export $(grep -v '^#' .env | xargs) | ||
# check required parameters | ||
declare -a required_vars=( | ||
"SPRING_BOOT_ADMIN_URL" | ||
"SERVER_HOST" | ||
"SERVER_PORT" | ||
"SPRING_BOOT_ADMIN_USERNAME" | ||
"SPRING_BOOT_ADMIN_PASSWORD" | ||
"SERVICE_NAME_COMPONENT" | ||
"SERVICE_DESCRIPTION_COMPONENT" | ||
# TODO: other? | ||
) | ||
|
||
for param in ${required_vars[@]}; | ||
do | ||
if [[ -z ${!param} ]]; then | ||
echo "Required variable \"$param\" is not set!" | ||
echo "The required variables are: ${required_vars[@]}" | ||
exit 4 | ||
fi | ||
done | ||
|
||
echo Downloading the models | ||
|
||
python -c "from utils.model_utils import load_models_and_tokenizers; load_models_and_tokenizers(); " | ||
|
||
echo Downloading the model finished | ||
|
||
echo SERVER_PORT: $SERVER_PORT | ||
echo Qanary pipeline at SPRING_BOOT_ADMIN_URL: $SPRING_BOOT_ADMIN_URL | ||
|
||
if [ -n $SERVER_PORT ] | ||
then | ||
exec gunicorn -b :$SERVER_PORT --access-logfile - --error-logfile - run:app # refer to the gunicorn documentation for more options | ||
fi | ||
echo The port number is: $SERVER_PORT | ||
echo The host is: $SERVER_HOST | ||
echo The Qanary pipeline URL is: $SPRING_BOOT_ADMIN_URL | ||
exec uvicorn run:app --host 0.0.0.0 --port $SERVER_PORT --log-level warning |
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
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
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