1
我嘗試使用下面的代碼以獲取標籤建議從Clarifai圖像:試圖從Clarifai預測,但得到一個異常
final ClarifaiClient client = new ClarifaiBuilder(CLIENT_ID, CLIENT_SECRET).buildSync();
final ClarifaiResponse<List<ClarifaiOutput<Concept>>> response = client.getDefaultModels().generalModel().predict().withInputs(ClarifaiInput.forImage(ClarifaiImage.of(IMAGE_URL))).executeSync();
然而,它提供了以下異常:
java.lang.IllegalArgumentException: @JsonAdapter value must be TypeAdapter or TypeAdapterFactory reference.
at com.google.gson.internal.bind.JsonAdapterAnnotationTypeAdapterFactory.getTypeAdapter(JsonAdapterAnnotationTypeAdapterFactory.java:64)
at com.google.gson.internal.bind.JsonAdapterAnnotationTypeAdapterFactory.create(JsonAdapterAnnotationTypeAdapterFactory.java:46)
at com.google.gson.Gson.getAdapter(Gson.java:360)
at com.google.gson.Gson.getAdapter(Gson.java:457)
at clarifai2.internal.AutoValueTypeAdapterFactory.create(AutoValueTypeAdapterFactory.java:35)
at com.google.gson.Gson.getAdapter(Gson.java:360)
at com.google.gson.Gson.toJson(Gson.java:597)
at com.google.gson.Gson.toJsonTree(Gson.java:498)
at com.google.gson.Gson.toJsonTree(Gson.java:477)
at clarifai2.api.request.model.PredictRequest$2.call(PredictRequest.java:73)
at clarifai2.api.request.model.PredictRequest$2.call(PredictRequest.java:71)
at clarifai2.internal.JSONArrayBuilder.addAll(JSONArrayBuilder.java:60)
at clarifai2.api.request.model.PredictRequest.buildRequest(PredictRequest.java:71)
at clarifai2.api.request.ClarifaiRequest$Builder.build(ClarifaiRequest.java:180)
at clarifai2.api.request.ClarifaiRequest$Builder.executeSync(ClarifaiRequest.java:188)
我在做什麼錯?