Upgrade to Pro — share decks privately, control downloads, hide ads and more …

「画像DE路線当てBot」で学ぶBot開発 / cogbot#8

「画像DE路線当てBot」で学ぶBot開発 / cogbot#8

HikaruMaruyama

August 30, 2017
Tweet

More Decks by HikaruMaruyama

Other Decks in Programming

Transcript

  1. ࢖ͬͨπʔϧ • Bot࣮૷ • Bot Builder SDK for Node.js •

    ࿏ઢΛ൑ఆ͢Δ෦෼ • cognitive services custom vision service • ӺΛऔಘ͢Δ෦෼ • Ӻ͢ͺ͋ͱWebαʔϏε • BotͷσϓϩΠઌ • azure • σϓϩΠͨ͠BotΛWebͰ؆୯ʹެ։͢Δ • microsoft bot framework
  2. ؙࢁͷεςʔλε • ॳΊͯ৮Δ • azure • microsoft bot framework •

    গ͠৮ͬͨ͜ͱ͕͋Δ • nodejs • ʮৄ͍͠ʯͱࣗ৴Λ࣋ͬͯݴ͑Δ • Ӻ͢ͺ͋ͱwebαʔϏε
  3. 1. custom vision service ͷઃఆ • ҎԼͷURLͰΞΧ΢ϯτΛ࡞੒͠·͢ • https://azure.microsoft.com/ja-jp/services/ cognitive-services/custom-vision-service/

    • େ৿࠼ࢠ͞Μͷqiitaهࣄ͕ຊ౰ʹΘ͔Γ΍͔ͬͨ͢Ͱ͢ • http://qiita.com/annie/items/ 293525901020685ad5f6 • ͜ΕΛΈͳ͕Βϙνϙνઃఆ͍͚ͯͩ͘͠
  4. 2. Bot BuilderΛ༻͍ͨ Bot࣮૷ • Bot Builder͸nodejs, C#͔બ୒Ͱ͖ΔͷͰɺ
 ͓޷͖ͳํΛ •

    ಓͷΓ͸௕͍ͷͰɺ͜͜͸αΫοͱ • ·ͣ࠷ॳ͸ɺެࣜυΩϡϝϯτʹॻ͍ͯ͋Δ௨Γ ʹ࣮ߦͯ͠ΈΔͷ͕٢ • https://docs.microsoft.com/en-us/bot- framework/nodejs/bot-builder-nodejs-quickstart • ͜͜ʹ੒Ռ෺(ιʔείʔυ)Λஔ͍ͯ·͢ • https://github.com/hmaruyama/train-finder-bot
  5. 2. Bot BuilderΛ༻͍ͨ Bot࣮૷ • ωοτ্ʹnodejsͷ৘ใ͕গͳ͍(ѹ౗తC#) • nodejsͰcustom vision apiΛݺͼग़͢ࡍʹศརͳϥΠϒϥϦ


    ͳ͍͔ͳʔͱௐ΂͍ͯͨΒɺcognitive servicesͷSDK͕
 ͋Δ͜ͱΛൃݟ • https://github.com/joshbalfour/node-cognitive-services • ͔͠͠custom vision͸·ͩະରԠͩͬͨ • custom vision api͸ɺը૾Λ൑ఆ͢ΔAPIΛݺͼग़͢ࡍʹɺ
 ը૾ϑΝΠϧ·ͨ͸ը૾URLΛPOST͢Δೋͭͷํ๏͕͋Δ͕ɺ ը૾ϑΝΠϧͰૹΔํ๏͕nodejsͰͲ͏΍Δͷ͔Θ͔Βͳ͔ͬͨ
  6. 2. Bot BuilderΛ༻͍ͨ Bot࣮૷ • nodejsͷதͰӺ͢ͺ͋ͱwebαʔϏε΋
 ݺͼग़͍ͨ͠ͷͰɺΞΫηεΩʔΛൃߦ͢Δ • https://ekiworld.net/service/lp/webservice/ •

    Ӻ͢ͺ͋ͱwebαʔϏεʹ͸ɺnodejsͰ࢖͑Δ ศརͳϥΠϒϥϦ౳͸༻ҙ͍ͯ͠ͳ͍ͷͰɺ
 ࣗ෼Ͱؤு࣮ͬͯ૷͢Δ
  7. 3. BotΛazureʹσϓϩΠ • azure͸ແྉͰΞΧ΢ϯτΛ࡞੒Ͱ͖·͢ • https://azure.microsoft.com/ja-jp/free/ • μογϡϘʔυʹϩάΠϯͨ͠ΒɺʮWebAppʯΛ࡞੒ • ࡞੒࣌ʹOSΛબ୒Ͱ͖ΔΜ͚ͩͲɺ


    ʮWindowsʯʹ͢Δͷ͕ແ೉ͩͦ͏ • σϓϩΠํ๏͸Ұ൪؆୯ͦ͏ͳʮϩʔΧϧGitϦϙδτϦʯΛબ୒͠·ͨ͠ • σϓϩΠ͕׬ྃͨ͠ΒɺҎԼͷURLΛୟ͍ͯ
 ͪΌΜͱϨεϙϯε͕ฦΔ͔֬ೝ • http://{{࡞੒ͨ͠ϦιʔεͷURL}}/api/messages • git push͢Δ͚ͩͰͳΜͰnode্ཱ͕͕ͪΔͷ͔·ͩཧղͰ͖͍ͯͳ͍
  8. 4. microsoft bot framework ͷઃఆ • ҎԼͷURLͰΞΧ΢ϯτΛ࡞੒͠·͢ • https://dev.botframework.com/ •

    ϩάΠϯͰ͖ͨΒBotΛొ࿥͠·͢ • Botొ࿥࣌ͷΤϯυϙΠϯτ͸”https”ͳ͜ͱʹ஫ҙ • ઌ΄ͲazureͰ࡞੒ͨ͠ϦιʔεURL͸httpsʹ΋
 ରԠ͍ͯ͠ΔΆ͍ • https://{{࡞੒ͨ͠ϦιʔεͷURL}}/api/messages • Botొ࿥࣌ʹදࣔ͞ΕΔMicrosoft App IDͱpassword͸ ޙ΄Ͳར༻͢ΔͷͰͲ͔͜ʹίϐʔ͓ͯ͘͠
  9. ײ૝ • ؆୯ʹBot͕࡞੒Ͱ͖·ͨ͠ʂ...ͱݴ͍͍ͨͱ͜Ζ
 ͚ͩͲɺࢥ͍௨Γʹߦ͔ͳ͍৔໘͕ଟʑ͋ͬͯ
 ৺͕ંΕͦ͏ͩͬͨ • ׳ΕΔ·Ͱ͸ਐΊΔͨͼʹ͕͔͔࣌ؒΓͦ͏ • ࣮ࡍͭ·͍ͮͨ࣌͸஌Γ߹͍ʹฉ͍ͯղܾ͍ͯͨ͠ •

    ͦΕ͕ͳ͔ͬͨΒࠓ೔ൃදͰ͖͍ͯͳ͔͔ͬͨ΋ • ࠷ॳΛ৐Γӽ͑Ε͹ɺָ͍͠Bot࡞੒ʹ
 ࣌ؒΛׂ͚ͦ͏⽃ • ༨ྗ͕͋Ε͹ৄ͍͠खॱΛϒϩάʹ·ͱΊΔ͔΋Ͱ͢