Clarifai
不是该存储库中的类... https://github.com/Clarifai/clarifai-java
AFAIK,您需要使用 create a ClarifaiBuilder
,然后调用build()
它,然后您可以调用getDefaultModels()
从单元测试。
@NotNull final ClarifaiClient client = new ClarifaiBuilder(appID, appSecret)
.baseURL(baseURL)
.client(new OkHttpClient.Builder()
.connectTimeout(60, TimeUnit.SECONDS)
.readTimeout(60, TimeUnit.SECONDS)
.writeTimeout(60, TimeUnit.SECONDS)
.addInterceptor(new HttpLoggingInterceptor(System.out::println).setLevel(HttpLoggingInterceptor.Level.BODY))
.build()
)
.buildSync();
...
@Test public void quickStartPredict() {
final ClarifaiResponse<List<ClarifaiOutput<Concept>>> predictionResults =
client.getDefaultModels().generalModel() // You can also do client.getModelByID("id") to get custom models
.predict()
.withInputs(
ClarifaiInput.forImage(ClarifaiImage.of("@@sampleTrain"))
)
.executeSync();
}