File size: 649 Bytes
0f68941
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/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)