# LINE Notify 程式碼 ```python= import jetson.inference import jetson.utils import requests def send_to_line(category,pic): params = {'message':"\n嗨,你好\n這是 \"火災警示\" 通知\n請注意!!\n偵測到 \"{0}\" 溫度過高".format(category)} files = {'imageFile': open(pic, 'rb')} headers = {'Authorization':'Bearer ' + "gOljwt8lLAnbpWSIXUk3RJP34Syw6NQADBtorl2GoCP"} r = requests.post("https://notify-api.line.me/api/notify", headers=headers, params=params, files=files) print(r.text) net = jetson.inference.detectNet("ssd-mobilenet-v2", threshold=0.5) camera = jetson.utils.videoSource("/dev/video0") display = jetson.utils.videoOutput("file://my_image.jpg") while True: img = camera.Capture() detections = net.Detect(img) display.Render(img) display.SetStatus("Object Detection | Network {:.0f} FPS".format(net.GetNetworkFPS())) if len(detections)>=1: # category = int(detections.ClassID) print(net.GetClassDesc(detections.classID)) # print(category) pic = '/home/iamai2021/Desktop/my_image.jpg' send_to_line( net.GetClassDesc(detections.classID) ,pic) if not camera.IsStreaming() or not display.IsStreaming(): break ``` :::warning **#遇到問題** ###### tags: `2021/09/06` 在學校網路測試時,遇到LINE_Notify_7.py跑不出來 原因:**網路沒插** ::: :::success **#解決方法** 借用學校的無線網卡 :::
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up