Web-service for antispoofing detection
bot.py
- runs telegram botapi.py
- contains local web-server implementation for local model testinginference.py
- contains feature extraction and model prediction functions + runs local testexample.py
- Telegram bot example
- Configure two variables in
bot.py
first:
# Telegram bot token
TOKEN = '<YOUR_TELEGRAM_BOT_TOKEN_GOES_HERE>'
# proxy server
REQUEST_KWARGS = {
'proxy_url': 'http://USERNAME:PASSWORD@YOUR_IP_ADDRESS:PORT',
}
- To run bot:
python3 bot.py
- To run local server:
python3 api.py
# to test the model output
curl -i -H "Content-Type: application/json" -X POST -d '{"FILE_PATH": "/home/anton/contests/boosters/deploy/git/web-antispoof/data/test/test_25s.wav"}' 127.0.0.1:5000/predict
- To run model test:
python3 inference.py
- To run remote API:
# on a remote machine
python3 api_remote.py
# to make a request from the same machine
python3 test_request.py
# to make a remote request change the "url" variable in test_request.py
- To build Docker image:
docker build -t web-antispoof:latest .
- To start bot-server we need to mount a folder to
/opt/audio
in container, where downloads will be stored:
docker run --rm -v <host_machine_path>:/opt/audio web-antispoof:latest
- To run API:
# select another port if it is not 5000
docker run --rm -p 5000:5000 web-antispoof:latest python3 api_remote.py