public void RecieveResults(QiskitRequest request, string results)
    {
        results = results.Replace('\'', '"');
        var stringDict = JSONParser.FromJson <Dictionary <string, float> >(results);

        var emotionBits = new List <int>();

        foreach (var emotion in request.emotions)
        {
            var bit = emotions.emotions.IndexOf(emotion);
            if (bit < 0)
            {
                bit = emotions.emotions.Count;
                emotions.emotions.Add(emotion);

                foreach (var state in emotions.states)
                {
                    state.emotions.Add(false);
                }
            }
            emotionBits.Add(bit);
        }

        if (emotions.states.Count == 0 || state.IsAdding)
        {
            AddResults(stringDict, emotionBits);
        }
        else
        {
            MultiplyResults(stringDict, emotionBits);
        }
    }
 public void AddRequest(QiskitRequest request, InstaImage image)
 {
     request.Normalise();
     requests.Enqueue(new Request()
     {
         request = request, image = image
     });
 }
示例#3
0
 public void SendRequest(QiskitRequest request, InstaImage image)
 {
     qiskitRequester.AddRequest(request, image);
 }