Skip to content

Commit 90f2a5c

Browse files
authored
Create a model for Image Analysis shared queries (#25951)
1 parent 0906e0e commit 90f2a5c

File tree

2 files changed

+31
-51
lines changed

2 files changed

+31
-51
lines changed

specification/cognitiveservices/Vision.ImageAnalysis/models.tsp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,34 @@ import "@typespec/http";
33
namespace ImageAnalysis;
44
using TypeSpec.Http;
55

6+
model SharedAnalyzeQuery {
7+
@query({
8+
name: "features",
9+
format: "csv",
10+
})
11+
@doc("A string indicating what visual feature types to return. Multiple values should be comma-separated. Valid visual feature types include: Tags, Caption, DenseCaptions, Objects, Read, SmartCrops, People. If VisualFeatures is not specified, then Categories, Tags, and Description are included in the response by default.")
12+
visualFeatures?: Array<visualFeatures>;
13+
14+
@query("model-name")
15+
@doc("The name of the custom trained model. This parameter needs to be specified if the parameter \"features\" is not specified.")
16+
modelName?: string;
17+
18+
@query("language")
19+
@doc("The desired language for output generation. If this parameter is not specified, the default value is \"en\". See https://aka.ms/cv-languages for a list of supported languages.")
20+
language?: string = "en";
21+
22+
@query({
23+
name: "smartcrops-aspect-ratios",
24+
format: "csv"
25+
})
26+
@doc("A list of aspect ratios to use for smartCrops feature. Aspect ratios are calculated by dividing the target crop width by the height. Supported values are between 0.75 and 1.8 (inclusive). Multiple values should be comma-separated. If this parameter is not specified, the service will return one crop suggestion with an aspect ratio it sees fit between 0.5 and 2.0 (inclusive).")
27+
smartCropsAspectRatios?: Array<float64>;
28+
29+
@query("gender-neutral-caption")
30+
@doc("Boolean flag for enabling gender-neutral captioning for caption and denseCaptions features. If this parameter is not specified, the default value is \"false\".")
31+
genderNeutralCaption?: boolean = false;
32+
}
33+
634
@doc("A basic rectangle")
735
model BoundingBox {
836
@doc("X coordinate")

specification/cognitiveservices/Vision.ImageAnalysis/routes.tsp

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -23,36 +23,12 @@ namespace ImageAnalysis;
2323
@action("analyze")
2424
op analyzeFromStream is Azure.Core.RpcOperation<
2525
{
26-
@query({
27-
name: "features",
28-
format: "csv",
29-
})
30-
@doc("A string indicating what visual feature types to return. Multiple values should be comma-separated. Valid visual feature types include: Tags, Caption, DenseCaptions, Objects, Read, SmartCrops, People. If VisualFeatures is not specified, then Categories, Tags, and Description are included in the response by default.")
31-
visualFeatures?: Array<visualFeatures>;
26+
...SharedAnalyzeQuery,
3227

3328
@doc("The format of the HTTP payload.")
3429
@header()
3530
contentType: "application/octet-stream";
3631

37-
@query("model-name")
38-
@doc("The name of the custom trained model. This parameter needs to be specified if the parameter \"features\" is not specified.")
39-
modelName?: string;
40-
41-
@query("language")
42-
@doc("The desired language for output generation. If this parameter is not specified, the default value is \"en\". See https://aka.ms/cv-languages for a list of supported languages.")
43-
language?: string = "en";
44-
45-
@query({
46-
name: "smartcrops-aspect-ratios",
47-
format: "csv"
48-
})
49-
@doc("A list of aspect ratios to use for smartCrops feature. Aspect ratios are calculated by dividing the target crop width by the height. Supported values are between 0.75 and 1.8 (inclusive). Multiple values should be comma-separated. If this parameter is not specified, the service will return one crop suggestion with an aspect ratio it sees fit between 0.5 and 2.0 (inclusive).")
50-
smartCropsAspectRatios?: Array<float64>;
51-
52-
@query("gender-neutral-caption")
53-
@doc("Boolean flag for enabling gender-neutral captioning for caption and denseCaptions features. If this parameter is not specified, the default value is \"false\".")
54-
genderNeutralCaption?: boolean = false;
55-
5632
@doc("The image to be analyzed")
5733
@body
5834
imageContents: bytes;
@@ -68,36 +44,12 @@ op analyzeFromStream is Azure.Core.RpcOperation<
6844
@action("analyze")
6945
op analyzeFromUrl is Azure.Core.RpcOperation<
7046
{
47+
...SharedAnalyzeQuery,
48+
7149
@doc("The format of the HTTP payload.")
7250
@header("Content-Type")
7351
contentType: "application/json";
7452

75-
@query({
76-
name: "features",
77-
format: "csv",
78-
})
79-
@doc("A string indicating what visual feature types to return. Multiple values should be comma-separated. Valid visual feature types include: Categories, Tags, Description, Faces, ImageType, Color, Adult, Brands, Objects, and Celebrities. If VisualFeatures is not specified, then Categories, Tags, and Description are included in the response by default.")
80-
visualFeatures?: Array<visualFeatures>;
81-
82-
@query("model-name")
83-
@doc("The name of the custom trained model. This parameter needs to be specified if the parameter \"features\" is not specified.")
84-
modelName?: string;
85-
86-
@query("language")
87-
@doc("The desired language for output generation. If this parameter is not specified, the default value is \"en\". See https://aka.ms/cv-languages for a list of supported languages.")
88-
language?: string = "en";
89-
90-
@query({
91-
name: "smartcrops-aspect-ratios",
92-
format: "csv"
93-
})
94-
@doc("A list of aspect ratios to use for smartCrops feature. Aspect ratios are calculated by dividing the target crop width by the height. Supported values are between 0.75 and 1.8 (inclusive). Multiple values should be comma-separated. If this parameter is not specified, the service will return one crop suggestion with an aspect ratio it sees fit between 0.5 and 2.0 (inclusive).")
95-
smartCropsAspectRatios?: Array<float64>;
96-
97-
@query("gender-neutral-caption")
98-
@doc("Boolean flag for enabling gender-neutral captioning for caption and denseCaptions features. If this parameter is not specified, the default value is \"false\".")
99-
genderNeutralCaption?: boolean = false;
100-
10153
@doc("The image to be analyzed")
10254
@body
10355
imageContents: ImageUrl;

0 commit comments

Comments
 (0)