Created
March 12, 2020 04:06
-
-
Save mountain/6dd910350c8ddb2411d2ebdfc5fee8d9 to your computer and use it in GitHub Desktop.
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
DIRECTION=$1 | |
SOURCE=$2 | |
if test -f $HOME/.xiaoyi ; then | |
. $HOME/.xiaoyi | |
else | |
echo "Please input ip of your node: " | |
read NODEIP | |
echo "NODEIP=$NODEIP" > $HOME/.xiaoyi | |
fi | |
BODY='{"source": ["'$SOURCE'"], "trans_type": "'$DIRECTION'", "replaced": true, "media": "text", "request_id": "demo" }' | |
export PYTHONIOENCODING=utf8 | |
curl -s -X POST http://$NODEIP/translator -H 'Content-Type: application/json' -d "$BODY" | python -c "import sys, json; print json.load(sys.stdin)['target'][0]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment