GithubHelp home page GithubHelp logo

Comments (5)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 24, 2024
Thanks for reporting the problem.  Can you try changing the type for Input.text 
as follows and see if it fixes the problem:

  public List<Object> text = new ArrayList<Object>();

Original comment by [email protected] on 22 Sep 2010 at 1:46

from google-api-java-client.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 24, 2024
 public List<Object> text = new ArrayList<Object>();   Does not work

I get the following : 
{"error":{"errors":[{"domain":"global","reason":"invalid","message":"'data' 
field must contain a JSON object."}],"code":400,"message":"'data' field must 
contain a JSON object."}}

This is what I did:
  List<Object> mix = new ArrayList<Object>();
  mix.add(text);
  content.data = mix;

Note : my problem is not with inputData.input.text.add(text) not working. The 
call is  working. I am not sure how to set the input to be of "mixture" type





Original comment by [email protected] on 22 Sep 2010 at 2:13

from google-api-java-client.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 24, 2024
Just change the "text" field name to "mixture".  It matches the name of the 
JSON key.

Original comment by [email protected] on 22 Sep 2010 at 2:33

  • Changed state: ByDesign

from google-api-java-client.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 24, 2024
I did not get it.

the text field is a class level variable defined in the Java API. I dont have 
an option to set this as mixture anywhere.

In the call - inputData.input.text.add(...) . text is a class level varible . 
Where Do I set it to be mixture.  

Code snippet:
InputData inputData = new InputData(); 
inputData.input.text.add(text); 
content.data = inputData; 
request.content = content; 



Original comment by [email protected] on 22 Sep 2010 at 4:15

from google-api-java-client.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 24, 2024
So , I did what you suggested.

Changed the Input class to be Input  class to be

public class Input {
  @Key
  public List<String> mixture = new ArrayList<String>();
}

and my predict call to be

inputData.input.mixture.add(text);


It did not work.

I get this error.
java.lang.IllegalArgumentException: data key not found
    at com.google.api.client.googleapis.json.JsonCParser.parserForResponse(JsonCParser.java:80)
    at com.google.api.client.googleapis.json.JsonCParser.parse(JsonCParser.java:49)
    at com.google.api.client.http.HttpResponse.parseAs(HttpResponse.java:280)
    at com.google.api.client.sample.prediction.PredictionSample.predict(PredictionSample.java:120)
    at com.google.api.client.sample.prediction.PredictionSample.main(PredictionSample.java:51)






Original comment by [email protected] on 1 Oct 2010 at 6:37

from google-api-java-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.