Skip to content

Commit

Permalink
feat: implement new pipeline snippet (#346)
Browse files Browse the repository at this point in the history
Because

- We have various trigger script for different model

This commit

- implement new pipeline snippet
  • Loading branch information
EiffelFly committed Feb 17, 2023
1 parent 9a82499 commit 01c8c41
Show file tree
Hide file tree
Showing 14 changed files with 380 additions and 60 deletions.
15 changes: 14 additions & 1 deletion src/lib/instill/model/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export type ModelInstance = {
uid: string;
id: string;
state: ModelState;
task: string;
task: ModelInstanceTask;
model_definition: string;
configuration: Record<string, any>;
create_time: string;
Expand All @@ -80,3 +80,16 @@ export type ModelInstanceReadme = {
content: string;
encoding: string;
};

export type ModelInstanceTask =
| "TASK_CLASSIFICATION"
| "TASK_DETECTION"
| "TASK_KEYPOINT"
| "TASK_OCR"
| "TASK_INSTANCE_SEGMENTATION"
| "TASK_SEMANTIC_SEGMENTATION"
| "TASK_TEXT_GENERATION"
| "TASK_TEXT_TO_IMAGE"
| "TASK_IMAGE_TO_IMAGE"
| "TASK_IMAGE_TO_TEXT"
| "TASK_UNSPECIFIED";
33 changes: 0 additions & 33 deletions src/lib/markdown/template/pipeline-code-template.mdx

This file was deleted.

38 changes: 38 additions & 0 deletions src/lib/markdown/template/pipeline-image-classification.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<CH.Code>

```sh cURL(url)
curl -X POST serverApiBaseUrlPlaceholder/v1alpha/pipelines/pipelineIdPlaceholder/trigger -d '{
"task_inputs": [
{
"classification": {
"image_url": "https://artifacts.instill.tech/imgs/dog.jpg"
}
},
{
"classification": {
"image_url": "https://artifacts.instill.tech/imgs/polar-bear.jpg"
}
}
]
}'
```

```sh cURL(base64)
curl -X POST serverApiBaseUrlPlaceholder/v1alpha/pipelines/pipelineIdPlaceholder/trigger -d '{
"task_inputs": [
{
"classification": {
"image_base64": "/9j/4AAQSk...D/2Q=="
}
}
]
}'
```

```sh cURL(multipart)
curl -X POST serverApiBaseUrlPlaceholder/v1alpha/pipelines/pipelineIdPlaceholder/trigger-multipart \
--form 'file=@"dog.jpg"' \
--form 'file=@"polar-bear.jpg"'
```

</CH.Code>
38 changes: 38 additions & 0 deletions src/lib/markdown/template/pipeline-instance-segmentation.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<CH.Code>

```sh cURL(url)
curl -X POST serverApiBaseUrlPlaceholder/v1alpha/pipelines/pipelineIdPlaceholder/trigger -d '{
"task_inputs": [
{
"instance_segmentation": {
"image_url": "https://artifacts.instill.tech/imgs/dog.jpg"
}
},
{
"instance_segmentation": {
"image_url": "https://artifacts.instill.tech/imgs/polar-bear.jpg"
}
}
]
}'
```

```sh cURL(base64)
curl -X POST serverApiBaseUrlPlaceholder/v1alpha/pipelines/pipelineIdPlaceholder/trigger -d '{
"task_inputs": [
{
"instance_segmentation": {
"image_base64": "/9j/4AAQSk...D/2Q=="
}
}
]
}'
```

```sh cURL(multipart)
curl -X POST serverApiBaseUrlPlaceholder/v1alpha/pipelines/pipelineIdPlaceholder/trigger-multipart \
--form 'file=@"dog.jpg"' \
--form 'file=@"polar-bear.jpg"'
```

</CH.Code>
32 changes: 32 additions & 0 deletions src/lib/markdown/template/pipeline-keypoint-detection.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<CH.Code>

```sh cURL(url)
curl -X POST serverApiBaseUrlPlaceholder/v1alpha/pipelines/pipelineIdPlaceholder/trigger -d '{
"task_inputs": [
{
"keypoint": {
"image_url": "https://artifacts.instill.tech/imgs/dance.jpg"
}
}
]
}'
```

```sh cURL(base64)
curl -X POST serverApiBaseUrlPlaceholder/v1alpha/pipelines/pipelineIdPlaceholder/trigger -d '{
"task_inputs": [
{
"keypoint": {
"image_base64": "/9j/4AAQSk...D/2Q=="
}
}
]
}'
```

```sh cURL(multipart)
curl -X POST serverApiBaseUrlPlaceholder/v1alpha/pipelines/pipelineIdPlaceholder/trigger-multipart \
--form 'file=@"dance.jpg"'
```

</CH.Code>
38 changes: 38 additions & 0 deletions src/lib/markdown/template/pipeline-object-detection.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<CH.Code>

```sh cURL(url)
curl -X POST serverApiBaseUrlPlaceholder/v1alpha/pipelines/pipelineIdPlaceholder/trigger -d '{
"task_inputs": [
{
"detection": {
"image_url": "https://artifacts.instill.tech/imgs/dog.jpg"
}
},
{
"detection": {
"image_url": "https://artifacts.instill.tech/imgs/polar-bear.jpg"
}
}
]
}'
```

```sh cURL(base64)
curl -X POST serverApiBaseUrlPlaceholder/v1alpha/pipelines/pipelineIdPlaceholder/trigger -d '{
"task_inputs": [
{
"detection": {
"image_base64": "/9j/4AAQSk...D/2Q=="
}
}
]
}'
```

```sh cURL(multipart)
curl -X POST serverApiBaseUrlPlaceholder/v1alpha/pipelines/pipelineIdPlaceholder/trigger-multipart \
--form 'file=@"dog.jpg"' \
--form 'file=@"polar-bear.jpg"'
```

</CH.Code>
32 changes: 32 additions & 0 deletions src/lib/markdown/template/pipeline-ocr.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<CH.Code>

```sh cURL(url)
curl -X POST serverApiBaseUrlPlaceholder/v1alpha/pipelines/pipelineIdPlaceholder/trigger -d '{
"task_inputs": [
{
"ocr": {
"image_url": "https://artifacts.instill.tech/imgs/sign-small.jpg"
}
}
]
}'
```

```sh cURL(base64)
curl -X POST serverApiBaseUrlPlaceholder/v1alpha/pipelines/pipelineIdPlaceholder/trigger -d '{
"task_inputs": [
{
"ocr": {
"image_base64": "/9j/4AAQSk...D/2Q=="
}
}
]
}'
```

```sh cURL(multipart)
curl -X POST serverApiBaseUrlPlaceholder/v1alpha/pipelines/pipelineIdPlaceholder/trigger-multipart \
--form 'file=@"sign-small.jpg"'
```

</CH.Code>
33 changes: 33 additions & 0 deletions src/lib/markdown/template/pipeline-semantic-segmentation.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<CH.Code>

```sh cURL(url)
curl -X POST serverApiBaseUrlPlaceholder/v1alpha/pipelines/pipelineIdPlaceholder/trigger -d '{
"task_inputs": [
{
"semantic_segmentation": {
"image_url": "https://artifacts.instill.tech/imgs/street.png"
}
}
]
}'
```

```sh cURL(base64)
curl -X POST serverApiBaseUrlPlaceholder/v1alpha/pipelines/pipelineIdPlaceholder/trigger -d '{
"task_inputs": [
{
"semantic_segmentation": {
"image_base64": "/9j/4AAQSk...D/2Q=="
}
}
]
}'
```

```sh cURL(multipart)
curl -X POST serverApiBaseUrlPlaceholder/v1alpha/pipelines/pipelineIdPlaceholder/trigger-multipart \
--form 'file=@"street.png"'

```

</CH.Code>
34 changes: 34 additions & 0 deletions src/lib/markdown/template/pipeline-text-to-image.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<CH.Code>

```sh cURL(url)
curl -X POST serverApiBaseUrlPlaceholder/v1alpha/pipelines/pipelineIdPlaceholder/trigger -d '{
"task_inputs": [
{
"text_to_image": {
"prompt": "a photo of an astronaut riding a horse on mars",
"steps": 5,
"cfg_scale": 7.5,
"seed": 0,
"samples": 1
}
}
]
}'
```

```sh cURL(base64)
curl -X POST serverApiBaseUrlPlaceholder/v1alpha/pipelines/pipelineIdPlaceholder/trigger -d '{
"task_inputs": [
{
"text_generation": {
"prompt": "he was worried",
"output_len": 97,
"topk": 5,
"seed": 0
}
}
]
}'
```

</CH.Code>
15 changes: 15 additions & 0 deletions src/lib/markdown/template/pipeline-unspecified.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<CH.Code>

```sh cURL(url)
curl -X POST serverApiBaseUrlPlaceholder/v1alpha/pipelines/pipelineIdPlaceholder/trigger -d '{
"task_inputs": [
{
"unspecified": {
"raw_inputs": [...]
}
}
]
}'
```

</CH.Code>
4 changes: 0 additions & 4 deletions src/pages/models/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,6 @@ const ModelDetailsPage: FC & {
modelInstance={selectedModelInstances}
marginBottom="mb-10"
/>
<TestModelInstanceSection
modelInstance={selectedModelInstances}
marginBottom="mb-10"
/>
</>
) : null}
</PageContentContainer>
Expand Down

0 comments on commit 01c8c41

Please sign in to comment.