開始使用免費開始

Scooter 派遣

市議會非常喜歡 Sam 對「電動滑板車是否阻擋人行道」的預測。喜歡到他們請她打造一個通知系統,派遣人員把佔用人行道的滑板車拖離。

有了她建立的資料集,只要請求的情感為負向,Sam 就能將人員派往該案件的座標位置。

Scooter Dataframe

在這個練習中,你會協助 Sam 建立一套依據情感分析與影像辨識來派遣人員的系統。你將幫助 Sam 結合人力與機器,讓市政管理更有效率!

本練習屬於課程

Python 中的 AWS Boto 入門

檢視課程

練習說明

  • 取得 'scooter_notifications' 的 SNS 主題 ARN。
  • 對每一列資料,若情感為 'NEGATIVE',且影像中有電動滑板車,則組合要傳送的訊息。
  • 將通知發佈到該 SNS 主題。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Get topic ARN for scooter notifications
topic_arn = sns.____(Name='____')['____']

for index, row in scooter_requests.iterrows():
    # Check if notification should be sent
    if (row['____'] == 'NEGATIVE') & (row['img_scooter'] == ____):
        # Construct a message to publish to the scooter team.
        message = "Please remove scooter at {}, {}. Description: {}".____(
            row['long'], row['lat'], row['public_description'])

        # Publish the message to the topic!
        sns.____(____ = topic_arn,
                    ____ = message, 
                    ____ = "Scooter Alert")
編輯並執行程式碼