Skip to content

Commit 56e94ed

Browse files
committed
Don't use plural if running cx predict on one sample
1 parent f470027 commit 56e94ed

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

cli/cmd/predict.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@ var predictCmd = &cobra.Command{
9393
fmt.Println("\n" + apiName + " was last updated on " + apiStart + "\n")
9494

9595
if predictResponse.ClassificationPredictions != nil {
96-
fmt.Println("Predicted classes:")
96+
if len(predictResponse.ClassificationPredictions) == 1 {
97+
fmt.Println("Predicted class:")
98+
} else {
99+
fmt.Println("Predicted classes:")
100+
}
97101
for _, prediction := range predictResponse.ClassificationPredictions {
98102
if prediction.PredictedClassReversed != nil {
99103
json, _ := json.Marshal(prediction.PredictedClassReversed)
@@ -104,7 +108,11 @@ var predictCmd = &cobra.Command{
104108
}
105109
}
106110
if predictResponse.RegressionPredictions != nil {
107-
fmt.Println("Predicted values:")
111+
if len(predictResponse.RegressionPredictions) == 1 {
112+
fmt.Println("Predicted value:")
113+
} else {
114+
fmt.Println("Predicted values:")
115+
}
108116
for _, prediction := range predictResponse.RegressionPredictions {
109117
if prediction.PredictedValueReversed != nil {
110118
json, _ := json.Marshal(prediction.PredictedValueReversed)

docs/quick-start.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ $ cortex predict iris-type irises.json
544544
545545
iris-type was last updated on Tuesday, February 14, 2019 at 2:57pm PST
546546
547-
Predicted classes:
547+
Predicted class:
548548
Iris-setosa
549549
```
550550

0 commit comments

Comments
 (0)