Beispiel #1
0
        public async Task <ResturantsResponse> PostPhoto()
        {
            var data = await this.Request.Content.ReadAsByteArrayAsync();

            var faces    = GetFaces(data);
            var emotions = GetEmotions(data);

            //string lat;
            //Request.Headers.TryGetValues("Lat")
            //var geoLoc = new GeoLocationParameters() {Lat =[@"Lat"], Lon = Request.Headers["Lon"]};

            var searchRequests = SearchRequestEvaluator.Evaluate(faces, emotions);
            var dataProvider   = new DoubleGisDataProvider();
            var firms          = searchRequests.Select(x => dataProvider.GetResturants(x.SearchQuery, x.Criteria));
            var defaultFirms   = dataProvider.GetResturants("", Enumerable.Empty <string>());

            var random            = new Random();
            var pickedResults     = Pick(firms.SelectMany(x => x.Variants), random.Next(4, 8)).ToArray().OrderByDescending(x => x.FlampOverallRating);
            var pickedResultNames = pickedResults.Select(x => x.Name);

            var defaultItems = Pick(defaultFirms.Variants.Where(x => !pickedResultNames.Contains(x.Name)), random.Next(2, 4)).OrderByDescending(x => x.FlampOverallRating);

            var result = new ResturantsResponse
            {
                Variants =
                    pickedResults.Concat(defaultItems)
                    .DistinctBy(x => x.Name)
                    .ToArray(),
                People = faces.Select(f => f.FaceAttributes).ToArray()
            };

            return(result);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            var doubleGisProvider = new DoubleGisDataProvider();
            var restaurants       = doubleGisProvider.GetResturants("Поесть", new[] { FoodServiceAttribute.KidsMenu });
            var bars = doubleGisProvider.GetResturants("Бары / Пабы", new string[] { }, new GeoLocationParameters()
            {
                Lat    = "55.022973",
                Lon    = "82.923464",
                Radius = 10000
            });
            var sushiRestaurant = doubleGisProvider.GetResturants("суши-бары / рестораны", new string[] { });

            var data = new HowOldDataProvider();

            var res = HowOldDataProvider.GetUserAge(File.ReadAllBytes(@"C:\Users\y.vasilyev\Pictures\avatar_210x210.jpg"));
        }
Beispiel #3
0
        public async Task <ResturantsResponse> PostPhoto()
        {
            var data = await Request.Content.ReadAsByteArrayAsync();

            var faces    = GetFaces(data);
            var emotions = GetEmotions(data);

            //string lat;
            //Request.Headers.TryGetValues("Lat")
            //var geoLoc = new GeoLocationParameters() {Lat =[@"Lat"], Lon = Request.Headers["Lon"]};

            var searchRequests = SearchRequestEvaluator.Evaluate(faces, emotions);
            var dataProvider   = new DoubleGisDataProvider();
            var firms          = searchRequests.Select(x => dataProvider.GetResturants(x.SearchQuery, x.Criteria));
            var defaultFirms   = dataProvider.GetResturants("", Enumerable.Empty <string>());

            return(new ResturantsResponse()
            {
                Variants = Pick(firms.SelectMany(x => x.Variants), 5).Union(Pick(defaultFirms.Variants, 2)).DistinctBy(x => x.Name).ToArray(),
                People = faces.Select(f => f.FaceAttributes).ToArray()
            });
        }