diff --git a/README.md b/README.md index 660ce97..4a5a291 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,11 @@ def train_your_nicest_model(your_nicest_parameters): import time time.sleep(10000) return {'loss': 0.9} # Optional return value + +#For sending direct message to telegram(Optional) +from knockknock import telegram_print + +telegram_print(text="",token="", chat_id=CHAT_ID) ``` #### Command-line diff --git a/knockknock/telegram_sender.py b/knockknock/telegram_sender.py index a3f91aa..a007ac9 100644 --- a/knockknock/telegram_sender.py +++ b/knockknock/telegram_sender.py @@ -95,3 +95,10 @@ def wrapper_sender(*args, **kwargs): return wrapper_sender return decorator_sender + + +def telegram_print(text:str,token: str, chat_id: int): + # telegram print sends the message to the telegram + # Ex: It can be used to send loss,accuracy during each epoch + bot = telegram.Bot(token=token) + bot.send_message(chat_id=chat_id, text=text) \ No newline at end of file