Skip to content

Commit e456b1b

Browse files
phelanpinglin
authored andcommitted
chore: update task input for stream method (#138)
Because - the stream method support multiple tasks This commit - define task input for stream method
1 parent 2ab2e42 commit e456b1b

File tree

8 files changed

+210
-8
lines changed

8 files changed

+210
-8
lines changed

openapiv2/openapiv2.swagger.yaml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3678,6 +3678,23 @@ definitions:
36783678
type: string
36793679
title: Image type base64
36803680
title: ClassificationInput represents the input of classification task
3681+
v1alphaClassificationInputStream:
3682+
type: object
3683+
properties:
3684+
file_lengths:
3685+
type: array
3686+
items:
3687+
type: string
3688+
format: uint64
3689+
title: The list of file length for each uploaded binary file
3690+
content:
3691+
type: string
3692+
format: byte
3693+
title: Content of images in bytes
3694+
title: ClassificationInputStream represents the input of classification task when using stream method
3695+
required:
3696+
- file_lengths
3697+
- content
36813698
v1alphaClassificationOutput:
36823699
type: object
36833700
properties:
@@ -4049,6 +4066,23 @@ definitions:
40494066
type: string
40504067
title: Image type base64
40514068
title: DetectionInput represents the input of detection task
4069+
v1alphaDetectionInputStream:
4070+
type: object
4071+
properties:
4072+
file_lengths:
4073+
type: array
4074+
items:
4075+
type: string
4076+
format: uint64
4077+
title: The list of file length for each uploaded binary file
4078+
content:
4079+
type: string
4080+
format: byte
4081+
title: Content of images in bytes
4082+
title: DetectionInputStream represents the input of detection task when using stream method
4083+
required:
4084+
- file_lengths
4085+
- content
40524086
v1alphaDetectionObject:
40534087
type: object
40544088
properties:
@@ -4228,6 +4262,23 @@ definitions:
42284262
type: string
42294263
title: Image type base64
42304264
title: InstanceSegmentationInput represents the input of instance segmentation task
4265+
v1alphaInstanceSegmentationInputStream:
4266+
type: object
4267+
properties:
4268+
file_lengths:
4269+
type: array
4270+
items:
4271+
type: string
4272+
format: uint64
4273+
title: The list of file length for each uploaded binary file
4274+
content:
4275+
type: string
4276+
format: byte
4277+
title: Content of images in bytes
4278+
title: InstanceSegmentationInputStream represents the input of instance segmentation task when using stream method
4279+
required:
4280+
- file_lengths
4281+
- content
42314282
v1alphaInstanceSegmentationObject:
42324283
type: object
42334284
properties:
@@ -4290,6 +4341,23 @@ definitions:
42904341
type: string
42914342
title: Image type base64
42924343
title: KeypointInput represents the input of keypoint detection task
4344+
v1alphaKeypointInputStream:
4345+
type: object
4346+
properties:
4347+
file_lengths:
4348+
type: array
4349+
items:
4350+
type: string
4351+
format: uint64
4352+
title: The list of file length for each uploaded binary file
4353+
content:
4354+
type: string
4355+
format: byte
4356+
title: Content of images in bytes
4357+
title: KeypointInputStream represents the input of keypoint detection task when using stream method
4358+
required:
4359+
- file_lengths
4360+
- content
42934361
v1alphaKeypointObject:
42944362
type: object
42954363
properties:
@@ -4989,6 +5057,23 @@ definitions:
49895057
type: string
49905058
title: Image type base64
49915059
title: OcrInput represents the input of ocr task
5060+
v1alphaOcrInputStream:
5061+
type: object
5062+
properties:
5063+
file_lengths:
5064+
type: array
5065+
items:
5066+
type: string
5067+
format: uint64
5068+
title: The list of file length for each uploaded binary file
5069+
content:
5070+
type: string
5071+
format: byte
5072+
title: Content of images in bytes
5073+
title: OcrInputStream represents the input of ocr task when using stream method
5074+
required:
5075+
- file_lengths
5076+
- content
49925077
v1alphaOcrObject:
49935078
type: object
49945079
properties:
@@ -5264,6 +5349,23 @@ definitions:
52645349
type: string
52655350
title: Image type base64
52665351
title: SemanticSegmentationInput represents the input of semantic segmentation task
5352+
v1alphaSemanticSegmentationInputStream:
5353+
type: object
5354+
properties:
5355+
file_lengths:
5356+
type: array
5357+
items:
5358+
type: string
5359+
format: uint64
5360+
title: The list of file length for each uploaded binary file
5361+
content:
5362+
type: string
5363+
format: byte
5364+
title: Content of images in bytes
5365+
title: SemanticSegmentationInputStream represents the input of semantic segmentation task when using stream method
5366+
required:
5367+
- file_lengths
5368+
- content
52675369
v1alphaSemanticSegmentationOutput:
52685370
type: object
52695371
properties:
@@ -5548,6 +5650,37 @@ definitions:
55485650
$ref: '#/definitions/v1alphaUnspecifiedInput'
55495651
title: The unspecified task input
55505652
title: Input represents the input to trigger a model instance
5653+
v1alphaTaskInputStream:
5654+
type: object
5655+
properties:
5656+
classification:
5657+
$ref: '#/definitions/v1alphaClassificationInputStream'
5658+
title: The classification input
5659+
detection:
5660+
$ref: '#/definitions/v1alphaDetectionInputStream'
5661+
title: The detection input
5662+
keypoint:
5663+
$ref: '#/definitions/v1alphaKeypointInputStream'
5664+
title: The keypoint input
5665+
ocr:
5666+
$ref: '#/definitions/v1alphaOcrInputStream'
5667+
title: The ocr input
5668+
instance_segmentation:
5669+
$ref: '#/definitions/v1alphaInstanceSegmentationInputStream'
5670+
title: The instance segmentation input
5671+
semantic_segmentation:
5672+
$ref: '#/definitions/v1alphaSemanticSegmentationInputStream'
5673+
title: The semantic segmentation input
5674+
text_to_image:
5675+
$ref: '#/definitions/v1alphaTextToImageInput'
5676+
title: The text to image input
5677+
text_generation:
5678+
$ref: '#/definitions/v1alphaTextGenerationInput'
5679+
title: The text generation input
5680+
unspecified:
5681+
$ref: '#/definitions/v1alphaUnspecifiedInput'
5682+
title: The unspecified task input
5683+
title: TaskInputStream represents the input to trigger a model instance with stream method
55515684
v1alphaTestModelInstanceBinaryFileUploadResponse:
55525685
type: object
55535686
properties:

vdp/model/v1alpha/model.proto

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,31 @@ message TaskInput {
524524
}
525525
}
526526

527+
// TaskInputStream represents the input to trigger a model instance with stream method
528+
message TaskInputStream {
529+
// Input type
530+
oneof input {
531+
// The classification input
532+
ClassificationInputStream classification = 1;
533+
// The detection input
534+
DetectionInputStream detection = 2;
535+
// The keypoint input
536+
KeypointInputStream keypoint = 3;
537+
// The ocr input
538+
OcrInputStream ocr = 4;
539+
// The instance segmentation input
540+
InstanceSegmentationInputStream instance_segmentation = 5;
541+
// The semantic segmentation input
542+
SemanticSegmentationInputStream semantic_segmentation = 6;
543+
// The text to image input
544+
TextToImageInput text_to_image = 7;
545+
// The text generation input
546+
TextGenerationInput text_generation = 8;
547+
// The unspecified task input
548+
UnspecifiedInput unspecified = 9;
549+
}
550+
}
551+
527552
// TaskOutput represents the output of a CV Task result from a model instance
528553
message TaskOutput {
529554
// The inference task output
@@ -585,10 +610,8 @@ message TriggerModelInstanceBinaryFileUploadRequest {
585610
(google.api.field_behavior) = REQUIRED,
586611
(google.api.resource_reference).type = "api.instill.tech/ModelInstance"
587612
];
588-
// The list of file length for each uploaded binary file
589-
repeated uint64 file_lengths = 2 [ (google.api.field_behavior) = REQUIRED ];
590-
// Content of images in bytes
591-
bytes content = 3 [ (google.api.field_behavior) = REQUIRED ];
613+
// Input to trigger the model instance
614+
TaskInputStream task_input = 2 [ (google.api.field_behavior) = REQUIRED ];
592615
}
593616

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

641662
// TestModelInstanceBinaryFileUploadResponse represents a response for the

vdp/model/v1alpha/task_classification.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ message ClassificationInput {
1616
}
1717
}
1818

19+
// ClassificationInputStream represents the input of classification task when using stream method
20+
message ClassificationInputStream {
21+
// The list of file length for each uploaded binary file
22+
repeated uint64 file_lengths = 1 [ (google.api.field_behavior) = REQUIRED ];
23+
// Content of images in bytes
24+
bytes content = 2 [ (google.api.field_behavior) = REQUIRED ];
25+
}
26+
1927
// ClassificationOutput represents the output of classification task
2028
message ClassificationOutput {
2129
// Classification category

vdp/model/v1alpha/task_detection.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ message DetectionInput {
2828
}
2929
}
3030

31+
// DetectionInputStream represents the input of detection task when using stream method
32+
message DetectionInputStream {
33+
// The list of file length for each uploaded binary file
34+
repeated uint64 file_lengths = 1 [ (google.api.field_behavior) = REQUIRED ];
35+
// Content of images in bytes
36+
bytes content = 2 [ (google.api.field_behavior) = REQUIRED ];
37+
}
38+
3139
// DetectionOutput represents the output of detection task
3240
message DetectionOutput {
3341
// A list of detection objects

vdp/model/v1alpha/task_instance_segmentation.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ message InstanceSegmentationInput {
3030
}
3131
}
3232

33+
// InstanceSegmentationInputStream represents the input of instance segmentation task when using stream method
34+
message InstanceSegmentationInputStream {
35+
// The list of file length for each uploaded binary file
36+
repeated uint64 file_lengths = 1 [ (google.api.field_behavior) = REQUIRED ];
37+
// Content of images in bytes
38+
bytes content = 2 [ (google.api.field_behavior) = REQUIRED ];
39+
}
40+
3341
// InstanceSegmentationOutput represents the output of instance segmentation
3442
// task
3543
message InstanceSegmentationOutput {

vdp/model/v1alpha/task_keypoint.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ message KeypointInput {
3838
}
3939
}
4040

41+
// KeypointInputStream represents the input of keypoint detection task when using stream method
42+
message KeypointInputStream {
43+
// The list of file length for each uploaded binary file
44+
repeated uint64 file_lengths = 1 [ (google.api.field_behavior) = REQUIRED ];
45+
// Content of images in bytes
46+
bytes content = 2 [ (google.api.field_behavior) = REQUIRED ];
47+
}
48+
4149
// KeypointOutput represents the output of keypoint detection task
4250
message KeypointOutput {
4351
// A list of keypoint objects

vdp/model/v1alpha/task_ocr.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ message OcrInput {
2828
}
2929
}
3030

31+
// OcrInputStream represents the input of ocr task when using stream method
32+
message OcrInputStream {
33+
// The list of file length for each uploaded binary file
34+
repeated uint64 file_lengths = 1 [ (google.api.field_behavior) = REQUIRED ];
35+
// Content of images in bytes
36+
bytes content = 2 [ (google.api.field_behavior) = REQUIRED ];
37+
}
38+
3139
// OcrOutput represents the output of ocr task
3240
message OcrOutput {
3341
// A list of OCR objects

vdp/model/v1alpha/task_semantic_segmentation.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ message SemanticSegmentationInput {
2424
}
2525
}
2626

27+
// SemanticSegmentationInputStream represents the input of semantic segmentation task when using stream method
28+
message SemanticSegmentationInputStream {
29+
// The list of file length for each uploaded binary file
30+
repeated uint64 file_lengths = 1 [ (google.api.field_behavior) = REQUIRED ];
31+
// Content of images in bytes
32+
bytes content = 2 [ (google.api.field_behavior) = REQUIRED ];
33+
}
34+
2735
// SemanticSegmentationOutput represents the output of semantic segmentation
2836
// task
2937
message SemanticSegmentationOutput {

0 commit comments

Comments
 (0)