Skip to content

Commit

Permalink
chore: update task input for stream method (#138)
Browse files Browse the repository at this point in the history
Because

- the stream method support multiple tasks

This commit

- define task input for stream method
  • Loading branch information
Phelan164 committed Mar 7, 2023
1 parent 89efe14 commit 94398f3
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 8 deletions.
37 changes: 29 additions & 8 deletions vdp/model/v1alpha/model.proto
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,31 @@ message TaskInput {
}
}

// TaskInputStream represents the input to trigger a model instance with stream method
message TaskInputStream {
// Input type
oneof input {
// The classification input
ClassificationInputStream classification = 1;
// The detection input
DetectionInputStream detection = 2;
// The keypoint input
KeypointInputStream keypoint = 3;
// The ocr input
OcrInputStream ocr = 4;
// The instance segmentation input
InstanceSegmentationInputStream instance_segmentation = 5;
// The semantic segmentation input
SemanticSegmentationInputStream semantic_segmentation = 6;
// The text to image input
TextToImageInput text_to_image = 7;
// The text generation input
TextGenerationInput text_generation = 8;
// The unspecified task input
UnspecifiedInput unspecified = 9;
}
}

// TaskOutput represents the output of a CV Task result from a model instance
message TaskOutput {
// The inference task output
Expand Down Expand Up @@ -585,10 +610,8 @@ message TriggerModelInstanceBinaryFileUploadRequest {
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference).type = "api.instill.tech/ModelInstance"
];
// The list of file length for each uploaded binary file
repeated uint64 file_lengths = 2 [ (google.api.field_behavior) = REQUIRED ];
// Content of images in bytes
bytes content = 3 [ (google.api.field_behavior) = REQUIRED ];
// Input to trigger the model instance
TaskInputStream task_input = 2 [ (google.api.field_behavior) = REQUIRED ];
}

// TriggerModelInstanceBinaryFileUploadResponse represents a response for the
Expand Down Expand Up @@ -632,10 +655,8 @@ message TestModelInstanceBinaryFileUploadRequest {
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference).type = "api.instill.tech/ModelInstance"
];
// The list of file length for each uploaded binary file
repeated uint64 file_lengths = 2 [ (google.api.field_behavior) = REQUIRED ];
// Content of images in bytes
bytes content = 3 [ (google.api.field_behavior) = REQUIRED ];
// Input to trigger the model instance
TaskInputStream task_input = 2 [ (google.api.field_behavior) = REQUIRED ];
}

// TestModelInstanceBinaryFileUploadResponse represents a response for the
Expand Down
8 changes: 8 additions & 0 deletions vdp/model/v1alpha/task_classification.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ message ClassificationInput {
}
}

// ClassificationInputStream represents the input of classification task when using stream method
message ClassificationInputStream {
// The list of file length for each uploaded binary file
repeated uint64 file_lengths = 1 [ (google.api.field_behavior) = REQUIRED ];
// Content of images in bytes
bytes content = 2 [ (google.api.field_behavior) = REQUIRED ];
}

// ClassificationOutput represents the output of classification task
message ClassificationOutput {
// Classification category
Expand Down
8 changes: 8 additions & 0 deletions vdp/model/v1alpha/task_detection.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ message DetectionInput {
}
}

// DetectionInputStream represents the input of detection task when using stream method
message DetectionInputStream {
// The list of file length for each uploaded binary file
repeated uint64 file_lengths = 1 [ (google.api.field_behavior) = REQUIRED ];
// Content of images in bytes
bytes content = 2 [ (google.api.field_behavior) = REQUIRED ];
}

// DetectionOutput represents the output of detection task
message DetectionOutput {
// A list of detection objects
Expand Down
8 changes: 8 additions & 0 deletions vdp/model/v1alpha/task_instance_segmentation.proto
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ message InstanceSegmentationInput {
}
}

// InstanceSegmentationInputStream represents the input of instance segmentation task when using stream method
message InstanceSegmentationInputStream {
// The list of file length for each uploaded binary file
repeated uint64 file_lengths = 1 [ (google.api.field_behavior) = REQUIRED ];
// Content of images in bytes
bytes content = 2 [ (google.api.field_behavior) = REQUIRED ];
}

// InstanceSegmentationOutput represents the output of instance segmentation
// task
message InstanceSegmentationOutput {
Expand Down
8 changes: 8 additions & 0 deletions vdp/model/v1alpha/task_keypoint.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ message KeypointInput {
}
}

// KeypointInputStream represents the input of keypoint detection task when using stream method
message KeypointInputStream {
// The list of file length for each uploaded binary file
repeated uint64 file_lengths = 1 [ (google.api.field_behavior) = REQUIRED ];
// Content of images in bytes
bytes content = 2 [ (google.api.field_behavior) = REQUIRED ];
}

// KeypointOutput represents the output of keypoint detection task
message KeypointOutput {
// A list of keypoint objects
Expand Down
8 changes: 8 additions & 0 deletions vdp/model/v1alpha/task_ocr.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ message OcrInput {
}
}

// OcrInputStream represents the input of ocr task when using stream method
message OcrInputStream {
// The list of file length for each uploaded binary file
repeated uint64 file_lengths = 1 [ (google.api.field_behavior) = REQUIRED ];
// Content of images in bytes
bytes content = 2 [ (google.api.field_behavior) = REQUIRED ];
}

// OcrOutput represents the output of ocr task
message OcrOutput {
// A list of OCR objects
Expand Down
8 changes: 8 additions & 0 deletions vdp/model/v1alpha/task_semantic_segmentation.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ message SemanticSegmentationInput {
}
}

// SemanticSegmentationInputStream represents the input of semantic segmentation task when using stream method
message SemanticSegmentationInputStream {
// The list of file length for each uploaded binary file
repeated uint64 file_lengths = 1 [ (google.api.field_behavior) = REQUIRED ];
// Content of images in bytes
bytes content = 2 [ (google.api.field_behavior) = REQUIRED ];
}

// SemanticSegmentationOutput represents the output of semantic segmentation
// task
message SemanticSegmentationOutput {
Expand Down

0 comments on commit 94398f3

Please sign in to comment.