public FacesController(IHostingEnvironment hostingEnvironment, AppDbContext context, CognitiveServices cognitiveServices, AccountServices accountServices) { _environment = hostingEnvironment; _context = context; _cognitiveServices = cognitiveServices; _accountServices = accountServices; }
public Main_Page() { InitializeComponent(); PickPhoto = new Command(PickPhoto_Tapped); TakePhoto = new Command(TakePhoto_Tapped); Classifier = new CognitiveServices(); BindingContext = this; }
/// <summary> /// POST: api/Messages /// Receive a message from a user and reply to it /// </summary> public async Task <HttpResponseMessage> Post([FromBody] Activity activity) { try { if (activity.Type == ActivityTypes.Message) { // Todo: assume the language will be the same throughout the conversation and store the state in user data. // re-evaluate the language only when no match //var detectedLanguage = await DetectLanguageAsync(activity.Text); //if (detectedLanguage != _defaultLanguage) //{ // //activity.Text = await TranslateTextFromAsync(detectedLanguage, activity.Text); //} var cognitiveService = new CognitiveServices(); if (activity.Text.StartsWith("feedback", StringComparison.CurrentCultureIgnoreCase)) { var result = cognitiveService.InterpreteFeedback("en", activity.Text); ConnectorClient client = new ConnectorClient(new Uri(activity.ServiceUrl)); Activity reply = activity.CreateReply(result); await client.Conversations.ReplyToActivityAsync(reply); } else if (activity.Text.StartsWith("language", StringComparison.CurrentCultureIgnoreCase)) { var result = await cognitiveService.DetectLanguageAsync(activity.Text); ConnectorClient client = new ConnectorClient(new Uri(activity.ServiceUrl)); Activity reply = activity.CreateReply($"Language detected {result}"); await client.Conversations.ReplyToActivityAsync(reply); } else { await Conversation.SendAsync(activity, () => new CustomQnAMakerDialog()); } } else { HandleSystemMessage(activity); } } catch (Exception e) { Console.WriteLine(e); } var response = Request.CreateResponse(HttpStatusCode.OK); return(response); }
public MainPageViewModel(INavigation navigation) { _navigation = navigation; CognitiveServices.Add(new AzureCogntiveService { Id = 1, Name = "Computer Vision", Service = CognitiveService.Vision, Description = "Distill actionable information from images" }); CognitiveServices.Add(new AzureCogntiveService { Id = 2, Name = "Custom Vision", Service = CognitiveService.Vision, Description = "Easily customize your own state-of-the-art computer vision models for your unique use case" }); CognitiveServices.Add(new AzureCogntiveService { Id = 3, Name = "Face", Service = CognitiveService.Vision, Description = "Detect, identify, analyze faces in photos" }); CognitiveServices.Add(new AzureCogntiveService { Id = 4, Name = "Text Analytics", Service = CognitiveService.Search, Description = "Easily evaluate sentiment and topics to understand what users want" }); }
// Internal Callback Function private void ExecuteOCR(byte[] imageData) { CognitiveServices cognitiveServices = new CognitiveServices(); StartCoroutine(cognitiveServices.PostToOCR(imageData)); }
// Internal Callback Function private void ExecuteFaceTracking(byte[] imageData) { CognitiveServices cognitiveServices = new CognitiveServices(); StartCoroutine(cognitiveServices.PostToFace(imageData)); }
public ProfilesController(AppDbContext context, AccountServices accountServices, CognitiveServices cognitiveServices) { _context = context; _accountServices = accountServices; _cognitiveServices = cognitiveServices; }