SlideShare ist ein Scribd-Unternehmen logo
1 von 26
Downloaden Sie, um offline zu lesen
Mobile Apps that
Understands
Your Intention When
You Typed
Marvin Heng
Twitter : @hmheng
Blog : http://hmheng.azurewebsites.net
Github: https://github.com/hmheng
{ } LUIS
Pre-requisites
• Installed Visual Studio 2017 for Windows with Xamarin
Cross-Platform component & all necessary platform-
specific SDK.
(Download a FREE Community Version here)
• An Azure account (Follow this to create a free one!)
• Create a cross platform mobile app with .NETStandard 2.0
(Learn to how to create one here)
• Created a Language Understanding Intelligent Service
(LUIS) (Learn how here, it is just simple as ABC)
Let’s create a LUIS subscription @
portal.azure.com
Setup LUIS at Azure Portal & luis.ai
1. Login with your Azure account @ portal.azure.com, click
“+New” and search for LUIS.
1b
1a
Setup LUIS at Azure Portal & luis.ai
2. Select “Language Understanding Intelligent Service”.
2
Setup LUIS at Azure Portal & luis.ai
3. Let’s hit “Create” to create a subscription for staging &
production.
3
Setup LUIS at Azure Portal & luis.ai
4. Enter your preferred name & the rest let it as default while I
select free pricing for this demo. Then click “Create”.
4
Setup LUIS at Azure Portal & luis.ai
5. Now, we head to www.luis.ai with what we created
previously in tutorial @ “Together We Can Make World
Smarter with LUIS”.
Setup LUIS at Azure Portal & luis.ai
6. Before we publish it to production, we need to click “Add
Key” to add a new key.
6
Setup LUIS at Azure Portal & luis.ai
7. Select your subscription that was just created at
portal.azure.com and click “Add Key”. A key should be
generated.
7
Setup LUIS at Azure Portal & luis.ai
8. Please take note of the Key in 8a, and app ID underlined in
light blue while endpoint in purple (Optionally obtained from
Dashboard) at 8b. We will need these information at later step.
8a 8b
Now, do a trick to let your mobile app
understand whatever you type!
1. Follow this tutorial to create a Xamarin.Forms app here.
Code App to Understands What You Typed
2. Replace the code in ContentPage.Content of MainPage.xaml
with following code.
…
<ContentPage.Content>
<StackLayout>
<Entry x:Name="txtMessage" Text="Command Here" />
<Button x:Name="btnConnect" Text="Send" />
<Label x:Name="lblIntentLabel" Text="Intent:" />
<Label x:Name="lblIntent" Text="" />
<Label x:Name="lblEntitiesLabel" Text="Entities:" />
<Label x:Name="lblEntities" Text="" />
</StackLayout>
</ContentPage.Content>
…
Code App to Understands What You Typed
2
Code App to Understands What You Typed
3. Next, we will need to get some sample code from LUIS’s
documentation and do some changes for Xamarin.
Code App to Understands What You Typed
4. Copy the code from MakeRequest function.
4
5. Paste it in MainPage.xaml.cs & make it an event function.
This function will call LUIS api & get the results from LUIS API.
public async void MakeRequest(object sender, EventArgs e)
{
var client = new HttpClient();
var queryString = HttpUtility.ParseQueryString(string.Empty);
// This app ID is for a public sample app that recognizes requests to turn on and turn off lights
var luisAppId = “<Your App Id>";
var subscriptionKey = “<Your App Key>";
// The request header contains your subscription key
client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", subscriptionKey);
// The "q" parameter contains the utterance to send to LUIS
queryString["q"] = txtMessage.Text;
// These optional request parameters are set to their default values
queryString["timezoneOffset"] = "0";
queryString["verbose"] = "false";
queryString["spellCheck"] = "false";
queryString["staging"] = "false";
var uri = "https://southeastasia.api.cognitive.microsoft.com/luis/v2.0/apps/" + luisAppId + "?" + queryString;
var response = await client.GetAsync(uri);
var strResponseContent = await response.Content.ReadAsStringAsync();
}
Code App to Understands What You Typed
5
6. Replace the ID, Key & endpoint region which you can obtain
from the previous page.
public async void MakeRequest(object sender, EventArgs e)
{
var client = new HttpClient();
var queryString = HttpUtility.ParseQueryString(string.Empty);
// This app ID is for a public sample app that recognizes requests to turn on and turn off lights
var luisAppId = “<Your App Id>";
var subscriptionKey = “<Your App Key>";
// The request header contains your subscription key
client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", subscriptionKey);
// The "q" parameter contains the utterance to send to LUIS
queryString["q"] = txtMessage.Text;
// These optional request parameters are set to their default values
queryString["timezoneOffset"] = "0";
queryString["verbose"] = "false";
queryString["spellCheck"] = "false";
queryString["staging"] = "false";
var uri = "https://southeastasia.api.cognitive.microsoft.com/luis/v2.0/apps/" + luisAppId + "?" + queryString;
var response = await client.GetAsync(uri);
var strResponseContent = await response.Content.ReadAsStringAsync();
}
Code App to Understands What You Typed
6a
6b
7. Create a new Folder “Models” and a Class
“LuisResponse.cs”
Code App to Understands What You Typed
7
8. Add in the following codes to the newly created class –
LuisResponse.cs for deserializing the response from LUIS later.
public class LuisResponse
{
public string query { get; set; }
public TopScoringIntent topScoringIntent { get; set; }
public List<Intent> intents { get; set; }
public List<Entity> entities { get; set; }
}
public class TopScoringIntent
{
public string intent { get; set; }
public double score { get; set; }
}
public class Intent
{
public string intent { get; set; }
public double score { get; set; }
}
public class Value
{
public string timex { get; set; }
public string type { get; set; }
public string value { get; set; }
}
….
Code App to Understands What You Typed
7
….
public class Resolution
{
public List<Value> values { get; set; }
}
public class Entity
{
public string entity { get; set; }
public string type { get; set; }
public int startIndex { get; set; }
public int endIndex { get; set; }
public double score { get; set; }
public Resolution resolution { get; set; }
}
9. Add following lines in white after the last line of
MakeRequest function.
…
var strResponseContent = await response.Content.ReadAsStringAsync();
try
{
lblIntent.Text = "";
lblEntities.Text = "";
LuisResponse luisResponse = JsonConvert.DeserializeObject<LuisResponse>(strResponseContent);
if (luisResponse != null)
{
if (luisResponse.topScoringIntent != null)
{
lblIntent.Text = luisResponse.topScoringIntent.intent;
}
if(luisResponse.entities.Count() > 0)
{
foreach (var entities in luisResponse.entities)
{
lblEntities.Text += entities.entity + "(" + entities.type + ")n";
}
}
}
}catch(Exception ex)
{
Console.WriteLine(ex.ToString());
}
…
Code App to Understands What You Typed
9
10. Now, we have to tell btnConnect to fire MakeRequest
function when the button is being clicked.
public MainPage()
{
InitializeComponent();
btnConnect.Clicked += MakeRequest;
}
Code App to Understands What You Typed
10
11. Let’s compile and run.
Code App to Understands What You Typed
12. Type your sentence, eg. “Meet Marvin at Starbucks
tomorrow”, you should get the intention & entities involved.
Code App to Understands What You Typed
12
Congratulation!
You’ve Unlocked The Very First LUIS App Challenge!
Mobile Apps that
Understands
Your Intention When
You Typed
Marvin Heng
Twitter : @hmheng
Blog : http://hmheng.azurewebsites.net
Github: https://github.com/hmheng
{ } LUIS

Weitere ähnliche Inhalte

Was ist angesagt?

Accessiblity 101 and JavaScript Frameworks
Accessiblity 101 and JavaScript Frameworks Accessiblity 101 and JavaScript Frameworks
Accessiblity 101 and JavaScript Frameworks Aimee Maree Forsstrom
 
Building a YellowAnt Application with Ruby on Rails
Building a YellowAnt Application with Ruby on RailsBuilding a YellowAnt Application with Ruby on Rails
Building a YellowAnt Application with Ruby on RailsJaya Jain
 
Creating azure logic app for salesforce integration | Webner
Creating azure logic app for salesforce integration | WebnerCreating azure logic app for salesforce integration | Webner
Creating azure logic app for salesforce integration | WebnerChandanWebner
 
Demystifying Keyword Driven Using Watir
Demystifying Keyword Driven Using WatirDemystifying Keyword Driven Using Watir
Demystifying Keyword Driven Using WatirHirday Lamba
 
How to convert custom plsql to web services-Soap OR Rest
How to convert custom plsql to web services-Soap OR RestHow to convert custom plsql to web services-Soap OR Rest
How to convert custom plsql to web services-Soap OR Restshravan kumar chelika
 
Zend Studio Tips and Tricks
Zend Studio Tips and TricksZend Studio Tips and Tricks
Zend Studio Tips and TricksRoy Ganor
 
Creation of simple application using - step by step
Creation of simple application using - step by stepCreation of simple application using - step by step
Creation of simple application using - step by steppriya Nithya
 
How to build integrated, professional enterprise-grade cross-platform mobile ...
How to build integrated, professional enterprise-grade cross-platform mobile ...How to build integrated, professional enterprise-grade cross-platform mobile ...
How to build integrated, professional enterprise-grade cross-platform mobile ...Appear
 
Android ui layouts ,cntls,webservices examples codes
Android ui layouts ,cntls,webservices examples codesAndroid ui layouts ,cntls,webservices examples codes
Android ui layouts ,cntls,webservices examples codesAravindharamanan S
 
Adopting 3D Touch in your apps
Adopting 3D Touch in your appsAdopting 3D Touch in your apps
Adopting 3D Touch in your appsJuan C Catalan
 
An R shiny demo for IDA MOOC facilitation, Developing Data Products
An R shiny demo for IDA MOOC facilitation, Developing Data ProductsAn R shiny demo for IDA MOOC facilitation, Developing Data Products
An R shiny demo for IDA MOOC facilitation, Developing Data ProductsWei Zhong Toh
 
Refactor code to testable
 Refactor code to testable Refactor code to testable
Refactor code to testableHokila Jan
 
Building a TV show with Angular, Bootstrap, and Web Services
Building a TV show with Angular, Bootstrap, and Web ServicesBuilding a TV show with Angular, Bootstrap, and Web Services
Building a TV show with Angular, Bootstrap, and Web ServicesDavid Giard
 
Android accessibility for developers and QA
Android accessibility for developers and QAAndroid accessibility for developers and QA
Android accessibility for developers and QATed Drake
 
What's New in Android
What's New in AndroidWhat's New in Android
What's New in AndroidRobert Cooper
 

Was ist angesagt? (20)

Accessiblity 101 and JavaScript Frameworks
Accessiblity 101 and JavaScript Frameworks Accessiblity 101 and JavaScript Frameworks
Accessiblity 101 and JavaScript Frameworks
 
Building a YellowAnt Application with Ruby on Rails
Building a YellowAnt Application with Ruby on RailsBuilding a YellowAnt Application with Ruby on Rails
Building a YellowAnt Application with Ruby on Rails
 
Day seven
Day sevenDay seven
Day seven
 
AIR & API
AIR & APIAIR & API
AIR & API
 
Developing in android
Developing in androidDeveloping in android
Developing in android
 
Creating azure logic app for salesforce integration | Webner
Creating azure logic app for salesforce integration | WebnerCreating azure logic app for salesforce integration | Webner
Creating azure logic app for salesforce integration | Webner
 
Session 2- day 3
Session 2- day 3Session 2- day 3
Session 2- day 3
 
Demystifying Keyword Driven Using Watir
Demystifying Keyword Driven Using WatirDemystifying Keyword Driven Using Watir
Demystifying Keyword Driven Using Watir
 
How to convert custom plsql to web services-Soap OR Rest
How to convert custom plsql to web services-Soap OR RestHow to convert custom plsql to web services-Soap OR Rest
How to convert custom plsql to web services-Soap OR Rest
 
Zend Studio Tips and Tricks
Zend Studio Tips and TricksZend Studio Tips and Tricks
Zend Studio Tips and Tricks
 
Creation of simple application using - step by step
Creation of simple application using - step by stepCreation of simple application using - step by step
Creation of simple application using - step by step
 
How to build integrated, professional enterprise-grade cross-platform mobile ...
How to build integrated, professional enterprise-grade cross-platform mobile ...How to build integrated, professional enterprise-grade cross-platform mobile ...
How to build integrated, professional enterprise-grade cross-platform mobile ...
 
Android ui layouts ,cntls,webservices examples codes
Android ui layouts ,cntls,webservices examples codesAndroid ui layouts ,cntls,webservices examples codes
Android ui layouts ,cntls,webservices examples codes
 
Adopting 3D Touch in your apps
Adopting 3D Touch in your appsAdopting 3D Touch in your apps
Adopting 3D Touch in your apps
 
An R shiny demo for IDA MOOC facilitation, Developing Data Products
An R shiny demo for IDA MOOC facilitation, Developing Data ProductsAn R shiny demo for IDA MOOC facilitation, Developing Data Products
An R shiny demo for IDA MOOC facilitation, Developing Data Products
 
Refactor code to testable
 Refactor code to testable Refactor code to testable
Refactor code to testable
 
Building a TV show with Angular, Bootstrap, and Web Services
Building a TV show with Angular, Bootstrap, and Web ServicesBuilding a TV show with Angular, Bootstrap, and Web Services
Building a TV show with Angular, Bootstrap, and Web Services
 
Codegnitorppt
CodegnitorpptCodegnitorppt
Codegnitorppt
 
Android accessibility for developers and QA
Android accessibility for developers and QAAndroid accessibility for developers and QA
Android accessibility for developers and QA
 
What's New in Android
What's New in AndroidWhat's New in Android
What's New in Android
 

Ähnlich wie AI: Mobile Apps That Understands Your Intention When You Typed

Integrating dialog flow (api.ai) into qiscus sdk chat application
Integrating dialog flow (api.ai) into qiscus sdk chat applicationIntegrating dialog flow (api.ai) into qiscus sdk chat application
Integrating dialog flow (api.ai) into qiscus sdk chat applicationErick Ranes Akbar Mawuntu
 
Mozilla Web Apps - Super-VanJS
Mozilla Web Apps - Super-VanJSMozilla Web Apps - Super-VanJS
Mozilla Web Apps - Super-VanJSRobert Nyman
 
SharePoint Conference 2018 - APIs, APIs everywhere!
SharePoint Conference 2018 - APIs, APIs everywhere!SharePoint Conference 2018 - APIs, APIs everywhere!
SharePoint Conference 2018 - APIs, APIs everywhere!Sébastien Levert
 
Telerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT ConferenceTelerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT ConferenceJen Looper
 
JavaOne Brasil 2016: JavaEE e HTML5: da web/desktop ao mobile
JavaOne Brasil 2016: JavaEE e HTML5: da web/desktop ao mobileJavaOne Brasil 2016: JavaEE e HTML5: da web/desktop ao mobile
JavaOne Brasil 2016: JavaEE e HTML5: da web/desktop ao mobileLoiane Groner
 
android level 3
android level 3android level 3
android level 3DevMix
 
SharePoint Saturday Belgium 2018 - APIs, APIs everywhere!
SharePoint Saturday Belgium 2018 - APIs, APIs everywhere!SharePoint Saturday Belgium 2018 - APIs, APIs everywhere!
SharePoint Saturday Belgium 2018 - APIs, APIs everywhere!Sébastien Levert
 
APIs, APIs Everywhere!
APIs, APIs Everywhere!APIs, APIs Everywhere!
APIs, APIs Everywhere!BIWUG
 
Leture5 exercise onactivities
Leture5 exercise onactivitiesLeture5 exercise onactivities
Leture5 exercise onactivitiesmaamir farooq
 
Lecture exercise on activities
Lecture exercise on activitiesLecture exercise on activities
Lecture exercise on activitiesmaamir farooq
 
Introduction To Google Android (Ft Rohan Bomle)
Introduction To Google Android (Ft Rohan Bomle)Introduction To Google Android (Ft Rohan Bomle)
Introduction To Google Android (Ft Rohan Bomle)Fafadia Tech
 
Parse cloud code
Parse cloud codeParse cloud code
Parse cloud code維佋 唐
 
jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013
jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013
jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013Kiril Iliev
 
Micro app-framework - NodeLive Boston
Micro app-framework - NodeLive BostonMicro app-framework - NodeLive Boston
Micro app-framework - NodeLive BostonMichael Dawson
 
Windows Azure: Connecting the Dots for a Mobile Workforce
Windows Azure: Connecting the Dots for a Mobile WorkforceWindows Azure: Connecting the Dots for a Mobile Workforce
Windows Azure: Connecting the Dots for a Mobile WorkforceTechWell
 
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...Wim Selles
 

Ähnlich wie AI: Mobile Apps That Understands Your Intention When You Typed (20)

Integrating dialog flow (api.ai) into qiscus sdk chat application
Integrating dialog flow (api.ai) into qiscus sdk chat applicationIntegrating dialog flow (api.ai) into qiscus sdk chat application
Integrating dialog flow (api.ai) into qiscus sdk chat application
 
Mozilla Web Apps - Super-VanJS
Mozilla Web Apps - Super-VanJSMozilla Web Apps - Super-VanJS
Mozilla Web Apps - Super-VanJS
 
SharePoint Conference 2018 - APIs, APIs everywhere!
SharePoint Conference 2018 - APIs, APIs everywhere!SharePoint Conference 2018 - APIs, APIs everywhere!
SharePoint Conference 2018 - APIs, APIs everywhere!
 
Node.js and Parse
Node.js and ParseNode.js and Parse
Node.js and Parse
 
Telerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT ConferenceTelerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT Conference
 
JavaOne Brasil 2016: JavaEE e HTML5: da web/desktop ao mobile
JavaOne Brasil 2016: JavaEE e HTML5: da web/desktop ao mobileJavaOne Brasil 2016: JavaEE e HTML5: da web/desktop ao mobile
JavaOne Brasil 2016: JavaEE e HTML5: da web/desktop ao mobile
 
android level 3
android level 3android level 3
android level 3
 
SharePoint Saturday Belgium 2018 - APIs, APIs everywhere!
SharePoint Saturday Belgium 2018 - APIs, APIs everywhere!SharePoint Saturday Belgium 2018 - APIs, APIs everywhere!
SharePoint Saturday Belgium 2018 - APIs, APIs everywhere!
 
APIs, APIs Everywhere!
APIs, APIs Everywhere!APIs, APIs Everywhere!
APIs, APIs Everywhere!
 
REST API for your WP7 App
REST API for your WP7 AppREST API for your WP7 App
REST API for your WP7 App
 
Leture5 exercise onactivities
Leture5 exercise onactivitiesLeture5 exercise onactivities
Leture5 exercise onactivities
 
Lecture exercise on activities
Lecture exercise on activitiesLecture exercise on activities
Lecture exercise on activities
 
Introduction To Google Android (Ft Rohan Bomle)
Introduction To Google Android (Ft Rohan Bomle)Introduction To Google Android (Ft Rohan Bomle)
Introduction To Google Android (Ft Rohan Bomle)
 
Parse cloud code
Parse cloud codeParse cloud code
Parse cloud code
 
jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013
jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013
jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013
 
Intro to Parse
Intro to ParseIntro to Parse
Intro to Parse
 
Micro app-framework - NodeLive Boston
Micro app-framework - NodeLive BostonMicro app-framework - NodeLive Boston
Micro app-framework - NodeLive Boston
 
Micro app-framework
Micro app-frameworkMicro app-framework
Micro app-framework
 
Windows Azure: Connecting the Dots for a Mobile Workforce
Windows Azure: Connecting the Dots for a Mobile WorkforceWindows Azure: Connecting the Dots for a Mobile Workforce
Windows Azure: Connecting the Dots for a Mobile Workforce
 
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
 

Mehr von Marvin Heng

Accelerating Personal Development through Microsoft Certifications
Accelerating Personal Development through Microsoft CertificationsAccelerating Personal Development through Microsoft Certifications
Accelerating Personal Development through Microsoft CertificationsMarvin Heng
 
Microsoft BotFramework - Global AI Bootcamp Nepal 2022
Microsoft BotFramework - Global AI Bootcamp Nepal 2022Microsoft BotFramework - Global AI Bootcamp Nepal 2022
Microsoft BotFramework - Global AI Bootcamp Nepal 2022Marvin Heng
 
Microsoft Cognitive Services at a Glance
Microsoft Cognitive Services at a GlanceMicrosoft Cognitive Services at a Glance
Microsoft Cognitive Services at a GlanceMarvin Heng
 
Create real value in your business process by automated data and form extraction
Create real value in your business process by automated data and form extractionCreate real value in your business process by automated data and form extraction
Create real value in your business process by automated data and form extractionMarvin Heng
 
A Journey with Microsoft Cognitive Service I
A Journey with Microsoft Cognitive Service IA Journey with Microsoft Cognitive Service I
A Journey with Microsoft Cognitive Service IMarvin Heng
 
A Journey With Microsoft Cognitive Services II
A Journey With Microsoft Cognitive Services IIA Journey With Microsoft Cognitive Services II
A Journey With Microsoft Cognitive Services IIMarvin Heng
 
AI and App Accessibility
AI and App AccessibilityAI and App Accessibility
AI and App AccessibilityMarvin Heng
 
What's New With Azure AI
What's New With Azure AIWhat's New With Azure AI
What's New With Azure AIMarvin Heng
 
Intelligent Assistant with Microsoft BotFramework
Intelligent Assistant with Microsoft BotFrameworkIntelligent Assistant with Microsoft BotFramework
Intelligent Assistant with Microsoft BotFrameworkMarvin Heng
 
Using AI to solve business challenges
Using AI to solve business challengesUsing AI to solve business challenges
Using AI to solve business challengesMarvin Heng
 
Intelligent Mobile App with Azure Custom Vision
Intelligent Mobile App with Azure Custom VisionIntelligent Mobile App with Azure Custom Vision
Intelligent Mobile App with Azure Custom VisionMarvin Heng
 
Azure Cognitive Services for Developers
Azure Cognitive Services for DevelopersAzure Cognitive Services for Developers
Azure Cognitive Services for DevelopersMarvin Heng
 
Bot & AI - A Bot for Productivity
Bot & AI - A Bot for ProductivityBot & AI - A Bot for Productivity
Bot & AI - A Bot for ProductivityMarvin Heng
 
Artificial Intelligence - Tell You What I See
Artificial Intelligence - Tell You What I SeeArtificial Intelligence - Tell You What I See
Artificial Intelligence - Tell You What I SeeMarvin Heng
 
Handwriting Detection with Microsoft Cognitive Services
Handwriting Detection with Microsoft Cognitive ServicesHandwriting Detection with Microsoft Cognitive Services
Handwriting Detection with Microsoft Cognitive ServicesMarvin Heng
 
Create a Q&A Bot to Serve Your Customers
Create a Q&A Bot to Serve Your CustomersCreate a Q&A Bot to Serve Your Customers
Create a Q&A Bot to Serve Your CustomersMarvin Heng
 
Facial Analysis with Angular Web App & ASP.NET Core
Facial Analysis with Angular Web App & ASP.NET CoreFacial Analysis with Angular Web App & ASP.NET Core
Facial Analysis with Angular Web App & ASP.NET CoreMarvin Heng
 
AI/ML/DL: Introduction to Deep Learning with Cognitive ToolKit
AI/ML/DL: Introduction to Deep Learning with Cognitive ToolKitAI/ML/DL: Introduction to Deep Learning with Cognitive ToolKit
AI/ML/DL: Introduction to Deep Learning with Cognitive ToolKitMarvin Heng
 
AI/ML/DL: Getting Started with Machine Learning on Azure
AI/ML/DL: Getting Started with Machine Learning on AzureAI/ML/DL: Getting Started with Machine Learning on Azure
AI/ML/DL: Getting Started with Machine Learning on AzureMarvin Heng
 
AI: Integrate Search Function into Your App Using Bing Search API.
AI: Integrate Search Function into Your App Using Bing Search API.AI: Integrate Search Function into Your App Using Bing Search API.
AI: Integrate Search Function into Your App Using Bing Search API.Marvin Heng
 

Mehr von Marvin Heng (20)

Accelerating Personal Development through Microsoft Certifications
Accelerating Personal Development through Microsoft CertificationsAccelerating Personal Development through Microsoft Certifications
Accelerating Personal Development through Microsoft Certifications
 
Microsoft BotFramework - Global AI Bootcamp Nepal 2022
Microsoft BotFramework - Global AI Bootcamp Nepal 2022Microsoft BotFramework - Global AI Bootcamp Nepal 2022
Microsoft BotFramework - Global AI Bootcamp Nepal 2022
 
Microsoft Cognitive Services at a Glance
Microsoft Cognitive Services at a GlanceMicrosoft Cognitive Services at a Glance
Microsoft Cognitive Services at a Glance
 
Create real value in your business process by automated data and form extraction
Create real value in your business process by automated data and form extractionCreate real value in your business process by automated data and form extraction
Create real value in your business process by automated data and form extraction
 
A Journey with Microsoft Cognitive Service I
A Journey with Microsoft Cognitive Service IA Journey with Microsoft Cognitive Service I
A Journey with Microsoft Cognitive Service I
 
A Journey With Microsoft Cognitive Services II
A Journey With Microsoft Cognitive Services IIA Journey With Microsoft Cognitive Services II
A Journey With Microsoft Cognitive Services II
 
AI and App Accessibility
AI and App AccessibilityAI and App Accessibility
AI and App Accessibility
 
What's New With Azure AI
What's New With Azure AIWhat's New With Azure AI
What's New With Azure AI
 
Intelligent Assistant with Microsoft BotFramework
Intelligent Assistant with Microsoft BotFrameworkIntelligent Assistant with Microsoft BotFramework
Intelligent Assistant with Microsoft BotFramework
 
Using AI to solve business challenges
Using AI to solve business challengesUsing AI to solve business challenges
Using AI to solve business challenges
 
Intelligent Mobile App with Azure Custom Vision
Intelligent Mobile App with Azure Custom VisionIntelligent Mobile App with Azure Custom Vision
Intelligent Mobile App with Azure Custom Vision
 
Azure Cognitive Services for Developers
Azure Cognitive Services for DevelopersAzure Cognitive Services for Developers
Azure Cognitive Services for Developers
 
Bot & AI - A Bot for Productivity
Bot & AI - A Bot for ProductivityBot & AI - A Bot for Productivity
Bot & AI - A Bot for Productivity
 
Artificial Intelligence - Tell You What I See
Artificial Intelligence - Tell You What I SeeArtificial Intelligence - Tell You What I See
Artificial Intelligence - Tell You What I See
 
Handwriting Detection with Microsoft Cognitive Services
Handwriting Detection with Microsoft Cognitive ServicesHandwriting Detection with Microsoft Cognitive Services
Handwriting Detection with Microsoft Cognitive Services
 
Create a Q&A Bot to Serve Your Customers
Create a Q&A Bot to Serve Your CustomersCreate a Q&A Bot to Serve Your Customers
Create a Q&A Bot to Serve Your Customers
 
Facial Analysis with Angular Web App & ASP.NET Core
Facial Analysis with Angular Web App & ASP.NET CoreFacial Analysis with Angular Web App & ASP.NET Core
Facial Analysis with Angular Web App & ASP.NET Core
 
AI/ML/DL: Introduction to Deep Learning with Cognitive ToolKit
AI/ML/DL: Introduction to Deep Learning with Cognitive ToolKitAI/ML/DL: Introduction to Deep Learning with Cognitive ToolKit
AI/ML/DL: Introduction to Deep Learning with Cognitive ToolKit
 
AI/ML/DL: Getting Started with Machine Learning on Azure
AI/ML/DL: Getting Started with Machine Learning on AzureAI/ML/DL: Getting Started with Machine Learning on Azure
AI/ML/DL: Getting Started with Machine Learning on Azure
 
AI: Integrate Search Function into Your App Using Bing Search API.
AI: Integrate Search Function into Your App Using Bing Search API.AI: Integrate Search Function into Your App Using Bing Search API.
AI: Integrate Search Function into Your App Using Bing Search API.
 

Kürzlich hochgeladen

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 

Kürzlich hochgeladen (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 

AI: Mobile Apps That Understands Your Intention When You Typed

  • 1. Mobile Apps that Understands Your Intention When You Typed Marvin Heng Twitter : @hmheng Blog : http://hmheng.azurewebsites.net Github: https://github.com/hmheng { } LUIS
  • 2. Pre-requisites • Installed Visual Studio 2017 for Windows with Xamarin Cross-Platform component & all necessary platform- specific SDK. (Download a FREE Community Version here) • An Azure account (Follow this to create a free one!) • Create a cross platform mobile app with .NETStandard 2.0 (Learn to how to create one here) • Created a Language Understanding Intelligent Service (LUIS) (Learn how here, it is just simple as ABC)
  • 3. Let’s create a LUIS subscription @ portal.azure.com
  • 4. Setup LUIS at Azure Portal & luis.ai 1. Login with your Azure account @ portal.azure.com, click “+New” and search for LUIS. 1b 1a
  • 5. Setup LUIS at Azure Portal & luis.ai 2. Select “Language Understanding Intelligent Service”. 2
  • 6. Setup LUIS at Azure Portal & luis.ai 3. Let’s hit “Create” to create a subscription for staging & production. 3
  • 7. Setup LUIS at Azure Portal & luis.ai 4. Enter your preferred name & the rest let it as default while I select free pricing for this demo. Then click “Create”. 4
  • 8. Setup LUIS at Azure Portal & luis.ai 5. Now, we head to www.luis.ai with what we created previously in tutorial @ “Together We Can Make World Smarter with LUIS”.
  • 9. Setup LUIS at Azure Portal & luis.ai 6. Before we publish it to production, we need to click “Add Key” to add a new key. 6
  • 10. Setup LUIS at Azure Portal & luis.ai 7. Select your subscription that was just created at portal.azure.com and click “Add Key”. A key should be generated. 7
  • 11. Setup LUIS at Azure Portal & luis.ai 8. Please take note of the Key in 8a, and app ID underlined in light blue while endpoint in purple (Optionally obtained from Dashboard) at 8b. We will need these information at later step. 8a 8b
  • 12. Now, do a trick to let your mobile app understand whatever you type!
  • 13. 1. Follow this tutorial to create a Xamarin.Forms app here. Code App to Understands What You Typed
  • 14. 2. Replace the code in ContentPage.Content of MainPage.xaml with following code. … <ContentPage.Content> <StackLayout> <Entry x:Name="txtMessage" Text="Command Here" /> <Button x:Name="btnConnect" Text="Send" /> <Label x:Name="lblIntentLabel" Text="Intent:" /> <Label x:Name="lblIntent" Text="" /> <Label x:Name="lblEntitiesLabel" Text="Entities:" /> <Label x:Name="lblEntities" Text="" /> </StackLayout> </ContentPage.Content> … Code App to Understands What You Typed 2
  • 15. Code App to Understands What You Typed 3. Next, we will need to get some sample code from LUIS’s documentation and do some changes for Xamarin.
  • 16. Code App to Understands What You Typed 4. Copy the code from MakeRequest function. 4
  • 17. 5. Paste it in MainPage.xaml.cs & make it an event function. This function will call LUIS api & get the results from LUIS API. public async void MakeRequest(object sender, EventArgs e) { var client = new HttpClient(); var queryString = HttpUtility.ParseQueryString(string.Empty); // This app ID is for a public sample app that recognizes requests to turn on and turn off lights var luisAppId = “<Your App Id>"; var subscriptionKey = “<Your App Key>"; // The request header contains your subscription key client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", subscriptionKey); // The "q" parameter contains the utterance to send to LUIS queryString["q"] = txtMessage.Text; // These optional request parameters are set to their default values queryString["timezoneOffset"] = "0"; queryString["verbose"] = "false"; queryString["spellCheck"] = "false"; queryString["staging"] = "false"; var uri = "https://southeastasia.api.cognitive.microsoft.com/luis/v2.0/apps/" + luisAppId + "?" + queryString; var response = await client.GetAsync(uri); var strResponseContent = await response.Content.ReadAsStringAsync(); } Code App to Understands What You Typed 5
  • 18. 6. Replace the ID, Key & endpoint region which you can obtain from the previous page. public async void MakeRequest(object sender, EventArgs e) { var client = new HttpClient(); var queryString = HttpUtility.ParseQueryString(string.Empty); // This app ID is for a public sample app that recognizes requests to turn on and turn off lights var luisAppId = “<Your App Id>"; var subscriptionKey = “<Your App Key>"; // The request header contains your subscription key client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", subscriptionKey); // The "q" parameter contains the utterance to send to LUIS queryString["q"] = txtMessage.Text; // These optional request parameters are set to their default values queryString["timezoneOffset"] = "0"; queryString["verbose"] = "false"; queryString["spellCheck"] = "false"; queryString["staging"] = "false"; var uri = "https://southeastasia.api.cognitive.microsoft.com/luis/v2.0/apps/" + luisAppId + "?" + queryString; var response = await client.GetAsync(uri); var strResponseContent = await response.Content.ReadAsStringAsync(); } Code App to Understands What You Typed 6a 6b
  • 19. 7. Create a new Folder “Models” and a Class “LuisResponse.cs” Code App to Understands What You Typed 7
  • 20. 8. Add in the following codes to the newly created class – LuisResponse.cs for deserializing the response from LUIS later. public class LuisResponse { public string query { get; set; } public TopScoringIntent topScoringIntent { get; set; } public List<Intent> intents { get; set; } public List<Entity> entities { get; set; } } public class TopScoringIntent { public string intent { get; set; } public double score { get; set; } } public class Intent { public string intent { get; set; } public double score { get; set; } } public class Value { public string timex { get; set; } public string type { get; set; } public string value { get; set; } } …. Code App to Understands What You Typed 7 …. public class Resolution { public List<Value> values { get; set; } } public class Entity { public string entity { get; set; } public string type { get; set; } public int startIndex { get; set; } public int endIndex { get; set; } public double score { get; set; } public Resolution resolution { get; set; } }
  • 21. 9. Add following lines in white after the last line of MakeRequest function. … var strResponseContent = await response.Content.ReadAsStringAsync(); try { lblIntent.Text = ""; lblEntities.Text = ""; LuisResponse luisResponse = JsonConvert.DeserializeObject<LuisResponse>(strResponseContent); if (luisResponse != null) { if (luisResponse.topScoringIntent != null) { lblIntent.Text = luisResponse.topScoringIntent.intent; } if(luisResponse.entities.Count() > 0) { foreach (var entities in luisResponse.entities) { lblEntities.Text += entities.entity + "(" + entities.type + ")n"; } } } }catch(Exception ex) { Console.WriteLine(ex.ToString()); } … Code App to Understands What You Typed 9
  • 22. 10. Now, we have to tell btnConnect to fire MakeRequest function when the button is being clicked. public MainPage() { InitializeComponent(); btnConnect.Clicked += MakeRequest; } Code App to Understands What You Typed 10
  • 23. 11. Let’s compile and run. Code App to Understands What You Typed
  • 24. 12. Type your sentence, eg. “Meet Marvin at Starbucks tomorrow”, you should get the intention & entities involved. Code App to Understands What You Typed 12
  • 25. Congratulation! You’ve Unlocked The Very First LUIS App Challenge!
  • 26. Mobile Apps that Understands Your Intention When You Typed Marvin Heng Twitter : @hmheng Blog : http://hmheng.azurewebsites.net Github: https://github.com/hmheng { } LUIS