Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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="<your_text>",token="<your_api_token>", chat_id=CHAT_ID)
```

#### Command-line
Expand Down
7 changes: 7 additions & 0 deletions knockknock/telegram_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)