Ejemplo n.º 1
0
        async void ConsultarUna(object sender, EventArgs e)
        {
            Predecir prediccionNueva = new Predecir();

            prediccionNueva.nombreImagen = "imagen1";
            prediccionNueva.imagen       = imagen64;
            var json = JsonConvert.SerializeObject(prediccionNueva);

            prediccionServer = await _servicio.PostImagenPredecir("https://murmuring-falls-94553.herokuapp.com/reconocimiento", json);

            Console.WriteLine(prediccionServer.ToString());
            BindingContext = prediccionServer;
        }
Ejemplo n.º 2
0
        public async Task <Prediccion> PostImagenPredecir(string URI, string json)
        {
            string     respuesta  = String.Empty;
            Prediccion prediccion = new Prediccion();

            try
            {
                StringContent jsonContent = new StringContent(json, Encoding.UTF8, "application/json");
                Console.WriteLine(json);
                HttpResponseMessage response = await _cliente.PostAsync(URI, jsonContent);

                respuesta = await response.Content.ReadAsStringAsync();

                prediccion = JsonConvert.DeserializeObject <Prediccion>(respuesta);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Not succeded");
                Debug.WriteLine(ex.Message);
            }
            return(prediccion);
        }
Ejemplo n.º 3
0
        private async void BtnEntrenar_Click(object sender, RoutedEventArgs e)
        {
            model = await Train();

            Evaluate(model);
            var destinoSel    = ((ANVI6MLNetCoreTechint.Destino)lstBoxDestino.SelectedItem).DestinoId;
            var categoriasSel = ((ANVI6MLNetCoreTechint.Categorias)lstBoxCat.SelectedItem).CategoriaId;

            DatosGenerales datosGeneralesNew = new DatosGenerales()
            {
                Categoria = (float)Convert.ToInt32(categoriasSel),
                Destino   = (float)Convert.ToInt32(destinoSel),
                Peso      = (float)Convert.ToInt32(txtPeso.Text)
            };
            PrediccionesIniciar prediccionesIniciar = new PrediccionesIniciar();

            prediccionesIniciar.Llenar(datosGeneralesNew);
            Prediccion prediccion = model.Predict(prediccionesIniciar.datosGenerales);

            txtResultado.Text  = "El tiempo de entrega del paquete se estima en:";
            txtResultado1.Text = prediccion.TiempoEntrega.ToString() + " hs.";
        }