brunneis's picture
Notify requests on Discord
0f68941 unverified
raw
history blame
649 Bytes
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# flake8: noqa E501
import requests
from src.envs import DISCORD_WEBHOOK_URL
def notify_discord(model_name: str) -> None:
if not DISCORD_WEBHOOK_URL:
return
discord_message = {
'content': 'A new evaluation request has been submitted for the model: {}'.format(model_name)
}
response = requests.post(
DISCORD_WEBHOOK_URL,
json=discord_message
)
if response.status_code != 204:
print('Failed to send message to Discord. Status code: {}'.format(response.status_code))
def notify(model_name: str) -> None:
notify_discord(model_name)