|
47 | 47 | */ |
48 | 48 | public class VisualRecognition extends BaseService { |
49 | 49 |
|
50 | | - private static final String DEFAULT_SERVICE_NAME = "watson_vision_combined"; |
| 50 | + private static final String DEFAULT_SERVICE_NAME = "visual_recognition"; |
51 | 51 |
|
52 | 52 | private static final String DEFAULT_SERVICE_URL = |
53 | 53 | "https://api.us-south.visual-recognition.watson.cloud.ibm.com"; |
@@ -154,14 +154,10 @@ public ServiceCall<ClassifiedImages> classify(ClassifyOptions classifyOptions) { |
154 | 154 | multipartBuilder.addFormDataPart("threshold", String.valueOf(classifyOptions.threshold())); |
155 | 155 | } |
156 | 156 | if (classifyOptions.owners() != null) { |
157 | | - for (String item : classifyOptions.owners()) { |
158 | | - multipartBuilder.addFormDataPart("owners", item); |
159 | | - } |
| 157 | + multipartBuilder.addFormDataPart("owners", RequestUtils.join(classifyOptions.owners(), ",")); |
160 | 158 | } |
161 | 159 | if (classifyOptions.classifierIds() != null) { |
162 | | - for (String item : classifyOptions.classifierIds()) { |
163 | | - multipartBuilder.addFormDataPart("classifier_ids", item); |
164 | | - } |
| 160 | + multipartBuilder.addFormDataPart("classifier_ids", RequestUtils.join(classifyOptions.classifierIds(), ",")); |
165 | 161 | } |
166 | 162 | builder.body(multipartBuilder.build()); |
167 | 163 | ResponseConverter<ClassifiedImages> responseConverter = |
@@ -224,16 +220,17 @@ public ServiceCall<Classifier> createClassifier(CreateClassifierOptions createCl |
224 | 220 | String partName = String.format("%s_positive_examples", entry.getKey()); |
225 | 221 | okhttp3.RequestBody part = |
226 | 222 | RequestUtils.inputStreamBody(entry.getValue(), "application/octet-stream"); |
227 | | - multipartBuilder.addFormDataPart(partName, entry.getKey(), part); |
| 223 | + multipartBuilder.addFormDataPart(partName, entry.getKey() + ".zip", part); |
228 | 224 | } |
229 | 225 | if (createClassifierOptions.negativeExamples() != null) { |
230 | 226 | okhttp3.RequestBody negativeExamplesBody = |
231 | 227 | RequestUtils.inputStreamBody( |
232 | 228 | createClassifierOptions.negativeExamples(), "application/octet-stream"); |
233 | | - multipartBuilder.addFormDataPart( |
234 | | - "negative_examples", |
235 | | - createClassifierOptions.negativeExamplesFilename(), |
236 | | - negativeExamplesBody); |
| 229 | + String negativeExamplesFilename = createClassifierOptions.negativeExamplesFilename(); |
| 230 | + if (!negativeExamplesFilename.contains(".")) { |
| 231 | + negativeExamplesFilename += ".zip"; |
| 232 | + } |
| 233 | + multipartBuilder.addFormDataPart("negative_examples", negativeExamplesFilename, negativeExamplesBody); |
237 | 234 | } |
238 | 235 | builder.body(multipartBuilder.build()); |
239 | 236 | ResponseConverter<Classifier> responseConverter = |
|
0 commit comments