#54: How to integrate alert system into a machine vision app ?

#54: How to integrate alert system into a machine vision app ?

This will be a tutorial with code snippets. So, if you are building/ planning to build your app in Python, and want to integrate a notification system, then this is the only resource you need.

How to build the interface?

I used Streamlit library. In this app, images of a product are being processed by a computer vision model. The user chooses the defect threshold from a slider. Each time, that threshold is breached, alerts are sent either on their email/ SMS or both. The interface looks like this:

The code I used to achieve this is:

Twilio for Text Messages

Twilio is a service that allows you to send SMS, WhatsApp messages, and even make voice calls. To use Twilio, you'll need to create a free trial account and provide details like your phone number, address, and ID proof.

SMTPlib for Email

Another common and easy way to send alerts is through mail. I used SMTlib. One important reminder is that if you are using Gmail with dual factor authentification, you'll need to create an 'app password' and replace your_email_password with it. You can read more on this link.

There are some other Python libraries that help you to send alerts:

  • slack_sdk: For Slack (You'll need to generate a token)
  • python-telegram-bot: For Telegram (You'll need a bot_token and chat_id)
  • Pushbullet (for Device Notifications)

Hope this tutorial helped !

Thank you for your time. Seeya..

要查看或添加评论,请登录

Riya Chhikara的更多文章

社区洞察

其他会员也浏览了