Ejemplo n.º 1
0
        private void AddSplitToList_Click(object sender, RoutedEventArgs e)
        {
            Split s = new Split(TitleInput.Text);

            SplitContainer.Items.Add(s.GetTitle());
            TitleInput.Focus();
            s.splitIndex = SplitContainer.Items.Count;
            //juu eihän tässä
            try
            {
                if (TargetHour.Text != null || TargetMin.Text != null || TargetSec.Text != null)
                {
                    TargetSplitList.Add(new Split(s.GetTitle())
                    {
                        splitIndex = s.splitIndex,
                        Time       = new TimeSpan(
                            int.Parse(TargetHour.Text),
                            int.Parse(TargetMin.Text),
                            int.Parse(TargetSec.Text))
                    });
                }
            }
            catch
            {
                Debug.WriteLine("TargetTime setting failed");
            }
            TitleInput.Text = "";
            TargetHour.Text = "0";
            TargetMin.Text  = "0";
            TargetSec.Text  = "0";
            SplitList.Add(s);
        }
Ejemplo n.º 2
0
        public ActionResult <List <float> > GetPrediction([FromBody] List <string> titles)
        {
            if ((modelLastDownload == null || DateTime.Now > modelLastDownload.Value.AddHours(5)))
            {
                //Save the model as zip
                byte[] model = _context.Models.ToList()[0].Model;
                System.IO.File.WriteAllBytes("model.zip", model);
                modelLastDownload = DateTime.Now;
            }

            //Load the Trained Model
            MLContext      mlContext = new MLContext();
            DataViewSchema modelSchema;
            ITransformer   trainedModel = mlContext.Model.Load("model.zip", out modelSchema);

            PredictionEngine <TitleInput, TitleOutput> predictionEngine = mlContext.Model.CreatePredictionEngine <TitleInput, TitleOutput>(trainedModel);

            //Prepare input data
            List <float> result = new List <float>();

            titles.ForEach(title =>
            {
                var temp = new TitleInput {
                    Title = title
                };
                result.Add(predictionEngine.Predict(temp).Probabilities);
            });

            return(result);
        }
Ejemplo n.º 3
0
        public async Task <ActionResult> SearchByTitle(TitleInput titleInput)
        {
            // make another games API call
            // call for Games, with a title of 'titleToSearchBy'
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("https://api.rawg.io/api/games");

            HttpResponseMessage response = await client.GetAsync("?search=" + titleInput.TitleToSearchBy);

            List <Item> itemsToChooseFrom = new List <Item>();

            if (response.IsSuccessStatusCode)
            {
                string data = await response.Content.ReadAsStringAsync();

                JObject jsonResults = JsonConvert.DeserializeObject <JObject>(data);


                for (int i = 0; i < 10; i++)
                {
                    JToken name     = jsonResults["results"][i]["name"];
                    JToken Released = jsonResults["results"][i]["released"];

                    Item randomItem = new Item();
                    randomItem.Name     = name.ToString();
                    randomItem.Released = Released.ToString();


                    itemsToChooseFrom.Add(randomItem);
                }
            }

            return(View("GamesIndex", itemsToChooseFrom));
        }
Ejemplo n.º 4
0
        public NameScreenAttrPageObject FillData(string title, string name, string email)
        {
            TitleInput.SendKeys(title);
            YourNameInput.SendKeys(name);
            EmailInput.SendKeys(email);

            return(this);
        }
Ejemplo n.º 5
0
 private void ClearInput()
 {
     TitleInput.Clear();
     DateInput.Clear();
     DescriptionInput.Clear();
 }
Ejemplo n.º 6
0
        public ActionResult SearchByTitle()
        {
            TitleInput input = new TitleInput();

            return(View(input));
        }
Ejemplo n.º 7
0
 public AddPage set_title_to(string title)
 {
     TitleInput.Clear();
     TitleInput.SendKeys(title);
     return(this);
 }