@transloadit/node 6.6.0 → 6.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -16
- package/dist/cli/semanticIntents/speechTranscribe.d.ts +16 -1
- package/dist/cli/semanticIntents/speechTranscribe.d.ts.map +1 -1
- package/dist/cli/semanticIntents/speechTranscribe.js +49 -5
- package/dist/cli/semanticIntents/speechTranscribe.js.map +1 -1
- package/package.json +2 -2
- package/src/cli/semanticIntents/speechTranscribe.ts +61 -11
package/README.md
CHANGED
|
@@ -440,6 +440,7 @@ npx transloadit preview generate --input <path|dir|url|-> [options]
|
|
|
440
440
|
| Flag | Type | Required | Example | Description |
|
|
441
441
|
| --- | --- | --- | --- | --- |
|
|
442
442
|
| `--format` | `string` | no | `jpg` | The output format for the generated thumbnail image. If a short video clip is generated using the clip strategy, its format is defined by clip_format. |
|
|
443
|
+
| `--quality` | `number` | no | `1` | Compression quality for still previews, from 1 to 100. When specified, the final image resize encodes directly into the requested format at this quality and strips embedded… |
|
|
443
444
|
| `--width` | `number` | no | `1` | Width of the thumbnail, in pixels. |
|
|
444
445
|
| `--height` | `number` | no | `1` | Height of the thumbnail, in pixels. |
|
|
445
446
|
| `--resize-strategy` | `string` | no | `crop` | To achieve the desired dimensions of the preview thumbnail, the Robot might have to resize the generated image. |
|
|
@@ -456,11 +457,11 @@ npx transloadit preview generate --input <path|dir|url|-> [options]
|
|
|
456
457
|
| `--icon-text-color` | `string` | no | `value` | The color of the text used in the icon. The format is #rrggbb[aa]. Only used if the icon strategy is applied. |
|
|
457
458
|
| `--icon-text-font` | `string` | no | `value` | The font family of the text used in the icon. Only used if the icon strategy is applied. Here is a list of all supported fonts. |
|
|
458
459
|
| `--icon-text-content` | `string` | no | `extension` | The content of the text box in generated icons. Only used if the icon_style parameter is set to with-text. The default value, extension, adds the file extension (e.g. MP4, JPEG)… |
|
|
459
|
-
| `--optimize` | `boolean` | no | `true` | Specifies whether the generated preview image should be optimized to reduce
|
|
460
|
+
| `--optimize` | `boolean` | no | `true` | Specifies whether the generated preview image should be optimized to reduce its file size while maintaining visual quality. |
|
|
460
461
|
| `--optimize-priority` | `string` | no | `compression-ratio` | Specifies whether conversion speed or compression ratio is prioritized when optimizing images. |
|
|
461
462
|
| `--optimize-progressive` | `boolean` | no | `true` | Specifies whether images should be interlaced, which makes the result image load progressively in browsers. |
|
|
462
463
|
| `--clip-format` | `string` | no | `apng` | The animated image format for the generated video clip. Only used if the clip strategy for video files is applied. Please consult the MDN Web Docs for detailed information about… |
|
|
463
|
-
| `--clip-offset` | `number` | no | `1` | The start position in seconds of where the clip is cut. Only used if the clip strategy for video files is applied.
|
|
464
|
+
| `--clip-offset` | `number` | no | `1` | The start position in seconds of where the clip is cut. Only used if the clip strategy for video files is applied. For large videos, only portions of the file may be imported to… |
|
|
464
465
|
| `--clip-duration` | `number` | no | `1` | The duration in seconds of the generated video clip. Only used if the clip strategy for video files is applied. Be aware that a longer clip duration also results in a larger file… |
|
|
465
466
|
| `--clip-framerate` | `number` | no | `1` | The framerate of the generated video clip. Only used if the clip strategy for video files is applied. Be aware that a higher framerate appears smoother but also results in a… |
|
|
466
467
|
| `--clip-loop` | `boolean` | no | `true` | Specifies whether the generated animated image should loop forever (true) or stop after playing the animation once (false). |
|
|
@@ -501,7 +502,7 @@ npx transloadit image remove-background --input <path|dir|url|-> [options]
|
|
|
501
502
|
| --- | --- | --- | --- | --- |
|
|
502
503
|
| `--select` | `string` | no | `foreground` | Region to select and keep in the image. The other region is removed. |
|
|
503
504
|
| `--format` | `string` | no | `png` | Format of the generated image. Defaults to PNG when not provided. |
|
|
504
|
-
| `--provider` | `string` | no | `aws` |
|
|
505
|
+
| `--provider` | `string` | no | `aws` | Chooses the best provider based on your request. Select a specific provider to override automatic selection. |
|
|
505
506
|
| `--model` | `string` | no | `value` | Provider-specific model to use for removing the background. Mostly intended for testing and evaluation. |
|
|
506
507
|
|
|
507
508
|
**Examples**
|
|
@@ -539,14 +540,19 @@ npx transloadit image merge --input <path|dir|url|-> [options]
|
|
|
539
540
|
| Flag | Type | Required | Example | Description |
|
|
540
541
|
| --- | --- | --- | --- | --- |
|
|
541
542
|
| `--format` | `string` | no | `jpg` | The output format for the modified image. |
|
|
542
|
-
| `--direction` | `string` | no | `horizontal` | Specifies the direction which the images are displayed. Only applies to the default spritesheet layout. Ignored when
|
|
543
|
+
| `--direction` | `string` | no | `horizontal` | Specifies the direction which the images are displayed. Use grid to arrange inputs left-to-right and top-to-bottom. Only applies to the default spritesheet layout. Ignored when… |
|
|
543
544
|
| `--effect` | `string` | no | `mosaic` | Applies a styled collage layout instead of a plain horizontal or vertical spritesheet. |
|
|
545
|
+
| `--columns` | `number` | no | `1` | Number of columns in the grid layout. Only applies when direction is grid. If omitted, columns are calculated automatically from the number of inputs and requested rows. |
|
|
546
|
+
| `--rows` | `number` | no | `1` | Number of rows in the grid layout. Only applies when direction is grid. If omitted, rows are calculated automatically from the number of inputs and requested columns. |
|
|
547
|
+
| `--cell-width` | `number` | no | `1` | Uniform width for each grid cell in pixels. Only applies when direction is grid. Images are resized to fit within the cell while preserving aspect ratio. |
|
|
548
|
+
| `--cell-height` | `number` | no | `1` | Uniform height for each grid cell in pixels. Only applies when direction is grid. Images are resized to fit within the cell while preserving aspect ratio. |
|
|
544
549
|
| `--border` | `number` | no | `1` | An integer value which defines the gap between images on the spritesheet. |
|
|
545
550
|
| `--background` | `string` | no | `transparent` | Either the hexadecimal code or name of the color used to fill the background (only shown with a border > 1). |
|
|
546
551
|
| `--width` | `number` | no | `1` | The output canvas width in pixels. This is mainly used by styled effects such as polaroid-stack and mosaic. |
|
|
547
552
|
| `--height` | `number` | no | `1` | The output canvas height in pixels. This is mainly used by styled effects such as polaroid-stack and mosaic. |
|
|
548
553
|
| `--seed` | `number` | no | `1` | Optional deterministic seed used by styled effects such as polaroid-stack and mosaic. |
|
|
549
554
|
| `--shuffle` | `boolean` | no | `true` | Whether styled effects such as polaroid-stack and mosaic may shuffle the input order before laying out the canvas. |
|
|
555
|
+
| `--sort-by` | `string` | no | `auto` | Controls how bundled inputs are ordered when no explicit numbered alias for the input type is used. |
|
|
550
556
|
| `--coverage` | `number` | no | `1` | Area-coverage multiplier for the polaroid-stack effect. Controls how large each polaroid is relative to the canvas and consequently how much of the canvas is covered by photos.… |
|
|
551
557
|
| `--adaptive-filtering` | `boolean` | no | `true` | Controls the image compression for PNG images. Setting to true results in smaller file size, while increasing processing time. It is encouraged to keep this option disabled. |
|
|
552
558
|
| `--quality` | `number` | no | `1` | Controls the image compression for JPG, PNG, and WebP images. Please also take a look at 🤖/image/optimize. |
|
|
@@ -631,7 +637,7 @@ npx transloadit image resize --input <path|dir|url|-> [options]
|
|
|
631
637
|
| `--resize-strategy` | `string` | no | `crop` | See the list of available resize strategies. |
|
|
632
638
|
| `--zoom` | `boolean` | no | `true` | If this is set to false, smaller images will not be stretched to the desired width and height. |
|
|
633
639
|
| `--crop` | `auto` | no | `value` | Specify an object containing coordinates for the top left and bottom right corners of the rectangle to be cropped from the original image(s). |
|
|
634
|
-
| `--gravity` | `string` | no | `bottom` |
|
|
640
|
+
| `--gravity` | `string` | no | `bottom` | Sets crop direction for crop or fillcrop without explicit coordinates. |
|
|
635
641
|
| `--strip` | `boolean` | no | `true` | Strips all metadata from the image. This is useful to keep thumbnails as small as possible. |
|
|
636
642
|
| `--alpha` | `string` | no | `Activate` | Gives control of the alpha/matte channel of an image. |
|
|
637
643
|
| `--preclip-alpha` | `string` | no | `Activate` | Gives control of the alpha/matte channel of an image before applying the clipping path via clip: true. |
|
|
@@ -651,7 +657,7 @@ npx transloadit image resize --input <path|dir|url|-> [options]
|
|
|
651
657
|
| `--brightness` | `number` | no | `1` | Increases or decreases the brightness of the image by using a multiplier. For example 1.5 would increase the brightness by 50%, and 0.75 would decrease the brightness by 25%. |
|
|
652
658
|
| `--saturation` | `number` | no | `1` | Increases or decreases the saturation of the image by using a multiplier. For example 1.5 would increase the saturation by 50%, and 0.75 would decrease the saturation by 25%. |
|
|
653
659
|
| `--hue` | `number` | no | `1` | Changes the hue by rotating the color of the image. The value 100 would produce no change whereas 0 and 200 will negate the colors in the image. |
|
|
654
|
-
| `--contrast` | `number` | no | `1` | Adjusts the contrast of the image. A value of 1 produces no change. Values below 1 decrease contrast
|
|
660
|
+
| `--contrast` | `number` | no | `1` | Adjusts the contrast of the image. A value of 1 produces no change. Values below 1 decrease contrast, and values above 1 increase it. Start with small adjustments, such as 0.9 or… |
|
|
655
661
|
| `--watermark-url` | `string` | no | `value` | A URL indicating a PNG image to be overlaid above this image. |
|
|
656
662
|
| `--watermark-position` | `string[]` | no | `bottom` | The position at which the watermark is placed. The available options are "center", "top", "bottom", "left", and "right". You can also combine options, such as "bottom-right". An… |
|
|
657
663
|
| `--watermark-x-offset` | `number` | no | `1` | The x-offset in number of pixels at which the watermark will be placed in relation to the position it has due to watermark_position. |
|
|
@@ -706,9 +712,9 @@ npx transloadit image upscale --input <path|dir|url|-> [options]
|
|
|
706
712
|
|
|
707
713
|
| Flag | Type | Required | Example | Description |
|
|
708
714
|
| --- | --- | --- | --- | --- |
|
|
709
|
-
| `--model` | `string` | no | `nightmareai/real-esrgan` | The AI model to use for image upscaling. Defaults to nightmareai/real-esrgan. |
|
|
710
|
-
| `--scale` | `number` | no | `2` | Upscale factor. Defaults to 2. |
|
|
711
|
-
| `--face-enhance` | `boolean` | no | `true` | Enable face enhancement
|
|
715
|
+
| `--model` | `string` | no | `nightmareai/real-esrgan` | The AI model to use for image upscaling. Defaults to nightmareai/real-esrgan. Real-ESRGAN inputs exceeding 2,096,704 pixels are resized proportionally before upscaling. |
|
|
716
|
+
| `--scale` | `number` | no | `2` | Upscale factor, applied after any input resizing. Defaults to 2. GFPGAN results are resized after restoration to match this factor. |
|
|
717
|
+
| `--face-enhance` | `boolean` | no | `true` | Enable face enhancement with Real-ESRGAN or face upsampling with CodeFormer. GFPGAN always performs face restoration and ignores this parameter. Defaults to false. |
|
|
712
718
|
|
|
713
719
|
**Examples**
|
|
714
720
|
|
|
@@ -749,7 +755,7 @@ npx transloadit document convert --input <path|dir|url|-> [options]
|
|
|
749
755
|
| `--markdown-theme` | `string` | no | `bare` | This parameter overhauls your Markdown files styling based on several canned presets. |
|
|
750
756
|
| `--pdf-margin` | `string` | no | `value` | PDF Paper margins, separated by , and with units. We support the following unit values: px, in, cm, mm. Currently this parameter is only supported when converting from html. |
|
|
751
757
|
| `--pdf-print-background` | `boolean` | no | `true` | Print PDF background graphics. Currently this parameter is only supported when converting from html. |
|
|
752
|
-
| `--pdf-format` | `string` | no | `A0` | PDF paper format. Currently this parameter is only supported when converting from html. |
|
|
758
|
+
| `--pdf-format` | `string` | no | `A0` | PDF paper format. Values are case-insensitive. Currently this parameter is only supported when converting from html. |
|
|
753
759
|
| `--pdf-display-header-footer` | `boolean` | no | `true` | Display PDF header and footer. Currently this parameter is only supported when converting from html. |
|
|
754
760
|
| `--pdf-header-template` | `string` | no | `value` | HTML template for the PDF print header. Should be valid HTML markup with following classes used to inject printing values into them: - date formatted print date - title document… |
|
|
755
761
|
| `--pdf-footer-template` | `string` | no | `value` | HTML template for the PDF print footer. Should use the same format as the pdf_header_template. Currently this parameter is only supported when converting from html, and requires… |
|
|
@@ -980,10 +986,12 @@ npx transloadit speech transcribe --input <path|dir|url|-> [options]
|
|
|
980
986
|
|
|
981
987
|
| Flag | Type | Required | Example | Description |
|
|
982
988
|
| --- | --- | --- | --- | --- |
|
|
983
|
-
| `--provider` | `string` | no | `replicate` | Provider to use for transcription. Defaults to replicate. |
|
|
989
|
+
| `--provider` | `string` | no | `replicate` | Provider to use for transcription. Defaults to replicate, or to aws with --speaker-labels. |
|
|
984
990
|
| `--format` | `string` | no | `text` | Output format. Defaults to text. |
|
|
985
991
|
| `--source-language` | `string` | no | `en-US` | Spoken language as a BCP-47 code, for providers that support explicit source languages. |
|
|
986
992
|
| `--target-language` | `string` | no | `french` | Sets the spoken language hint for the "replicate" provider. Omit this parameter to detect the spoken language automatically. Set it to the full lowercase English language name,… |
|
|
993
|
+
| `--speaker-labels` | `boolean` | no | — | Label who is speaking: one paragraph per speaker in text, voice spans in WebVTT. Uses aws or gcp. |
|
|
994
|
+
| `--max-speakers` | `number` | no | — | Maximum number of speakers to label, from 1 to 10. Requires --speaker-labels. |
|
|
987
995
|
|
|
988
996
|
**Examples**
|
|
989
997
|
|
|
@@ -992,6 +1000,8 @@ npx transloadit speech transcribe --input <path|dir|url|-> [options]
|
|
|
992
1000
|
transloadit speech transcribe --input voice.opus --output voice.txt
|
|
993
1001
|
# Generate subtitles
|
|
994
1002
|
transloadit speech transcribe --input clip.mp4 --format webvtt --output captions.vtt
|
|
1003
|
+
# Label who is speaking in an interview
|
|
1004
|
+
transloadit speech transcribe --input interview.mp4 --speaker-labels --output interview.txt
|
|
995
1005
|
```
|
|
996
1006
|
|
|
997
1007
|
#### `text speak`
|
|
@@ -1023,7 +1033,7 @@ npx transloadit text speak [--input <path|dir|url|->] [options]
|
|
|
1023
1033
|
| Flag | Type | Required | Example | Description |
|
|
1024
1034
|
| --- | --- | --- | --- | --- |
|
|
1025
1035
|
| `--prompt` | `string` | no | `"A red bicycle in a studio"` | Which text to speak. You can also set this to null and supply an input text file. |
|
|
1026
|
-
| `--provider` | `string` |
|
|
1036
|
+
| `--provider` | `string` | no | `aws` | Chooses the best provider based on your request. Select a specific provider to override automatic selection. |
|
|
1027
1037
|
| `--target-language` | `string` | no | `en-US` | The written language of the document. This will also be the language of the spoken text. The language should be specified in the BCP-47 format, such as "en-GB", "de-DE" or… |
|
|
1028
1038
|
| `--voice` | `string` | no | `female-1` | The gender to be used for voice synthesis. Please consult the list of supported languages and voices. |
|
|
1029
1039
|
| `--ssml` | `boolean` | no | `true` | Supply Speech Synthesis Markup Language instead of raw text, in order to gain more control over how your text is voiced, including rests and pronounciations. |
|
|
@@ -1031,7 +1041,7 @@ npx transloadit text speak [--input <path|dir|url|->] [options]
|
|
|
1031
1041
|
**Examples**
|
|
1032
1042
|
|
|
1033
1043
|
```bash
|
|
1034
|
-
transloadit text speak --input input.pdf --
|
|
1044
|
+
transloadit text speak --input input.pdf --output output.mp3
|
|
1035
1045
|
```
|
|
1036
1046
|
|
|
1037
1047
|
#### `video thumbs`
|
|
@@ -1066,12 +1076,14 @@ npx transloadit video thumbs --input <path|dir|url|-> [options]
|
|
|
1066
1076
|
| `--count` | `number` | no | `1` | The number of thumbnails to be extracted. As some videos have incorrect durations, the actual number of thumbnails generated may be less in rare cases. The maximum number of… |
|
|
1067
1077
|
| `--offsets` | `auto` | no | `value` | An array of offsets representing seconds of the file duration, such as [ 2, 45, 120 ]. |
|
|
1068
1078
|
| `--format` | `string` | no | `jpg` | The format of the extracted thumbnail. Supported values are "jpg", "jpeg" and "png". Even if you specify the format to be "jpeg" the resulting thumbnails will have a "jpg" file… |
|
|
1069
|
-
| `--width` | `number` | no | `1` | The width of the thumbnail, in pixels.
|
|
1070
|
-
| `--height` | `number` | no | `1` | The height
|
|
1079
|
+
| `--width` | `number` | no | `1` | The width of the thumbnail, in pixels. Omit or use null for the original width of the video. |
|
|
1080
|
+
| `--height` | `number` | no | `1` | The thumbnail height in pixels, capped like width. Omit or use null for the original height. |
|
|
1071
1081
|
| `--resize-strategy` | `string` | no | `crop` | One of the available resize strategies. |
|
|
1072
|
-
| `--background` | `string` | no | `value` | The background color of the resulting thumbnails in the "rrggbbaa" format (red, green, blue, alpha) when used with the "pad" resize strategy. The default color is black. |
|
|
1082
|
+
| `--background` | `string` | no | `value` | The background color of the resulting thumbnails in the "rrggbbaa" format (red, green, blue, alpha) when used with the "pad" resize strategy. The default color is opaque black. |
|
|
1073
1083
|
| `--rotate` | `number` | no | `0` | Forces the video to be rotated by the specified degree integer. |
|
|
1074
1084
|
| `--input-codec` | `string` | no | `value` | Specifies the input codec to use when decoding the video. This is useful for videos with special codecs that require specific decoders. |
|
|
1085
|
+
| `--smart` | `boolean` | no | `true` | When set to true, enables AI-powered smart thumbnail selection. |
|
|
1086
|
+
| `--smart-max-candidates` | `number` | no | `1` | The maximum size of the candidate pool when smart is true. The Robot analyzes up to three candidates per requested thumbnail, capped by this value, but it will never analyze… |
|
|
1075
1087
|
|
|
1076
1088
|
**Examples**
|
|
1077
1089
|
|
|
@@ -2313,3 +2325,4 @@ Thanks to [Ian Hansen](https://github.com/supershabam) for donating the `translo
|
|
|
2313
2325
|
## Development
|
|
2314
2326
|
|
|
2315
2327
|
See [CONTRIBUTING](./CONTRIBUTING.md).
|
|
2328
|
+
|
|
@@ -13,7 +13,7 @@ export declare const speechTranscribeSemanticIntentDescriptor: {
|
|
|
13
13
|
readonly kind: "string";
|
|
14
14
|
readonly propertyName: "provider";
|
|
15
15
|
readonly optionFlags: "--provider";
|
|
16
|
-
readonly description: "Provider to use for transcription. Defaults to replicate.";
|
|
16
|
+
readonly description: "Provider to use for transcription. Defaults to replicate, or to aws with --speaker-labels.";
|
|
17
17
|
readonly required: false;
|
|
18
18
|
readonly exampleValue: "replicate";
|
|
19
19
|
}, {
|
|
@@ -40,6 +40,21 @@ export declare const speechTranscribeSemanticIntentDescriptor: {
|
|
|
40
40
|
readonly description: string;
|
|
41
41
|
readonly required: false;
|
|
42
42
|
readonly exampleValue: "french";
|
|
43
|
+
}, {
|
|
44
|
+
readonly name: "speaker_labels";
|
|
45
|
+
readonly kind: "boolean";
|
|
46
|
+
readonly propertyName: "speakerLabels";
|
|
47
|
+
readonly optionFlags: "--speaker-labels";
|
|
48
|
+
readonly description: "Label who is speaking: one paragraph per speaker in text, voice spans in WebVTT. Uses aws or gcp.";
|
|
49
|
+
readonly required: false;
|
|
50
|
+
}, {
|
|
51
|
+
readonly name: "max_speakers";
|
|
52
|
+
readonly kind: "number";
|
|
53
|
+
readonly propertyName: "maxSpeakers";
|
|
54
|
+
readonly optionFlags: "--max-speakers";
|
|
55
|
+
readonly description: "Maximum number of speakers to label, from 1 to 10. Requires --speaker-labels.";
|
|
56
|
+
readonly required: false;
|
|
57
|
+
readonly exampleValue: 2;
|
|
43
58
|
}];
|
|
44
59
|
};
|
|
45
60
|
readonly inputPolicy: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"speechTranscribe.d.ts","sourceRoot":"","sources":["../../../src/cli/semanticIntents/speechTranscribe.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"speechTranscribe.d.ts","sourceRoot":"","sources":["../../../src/cli/semanticIntents/speechTranscribe.ts"],"names":[],"mappings":"AA8JA,iBAAS,0BAA0B,CACjC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,QAAQ,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,GAC/B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA4BzB;AAED,eAAO,MAAM,wCAAwC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAnF9C,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;;;CA2Fe,CAAA"}
|
|
@@ -19,7 +19,7 @@ const speechTranscribeExecutionDefinition = {
|
|
|
19
19
|
kind: 'string',
|
|
20
20
|
propertyName: 'provider',
|
|
21
21
|
optionFlags: '--provider',
|
|
22
|
-
description: 'Provider to use for transcription. Defaults to replicate.',
|
|
22
|
+
description: 'Provider to use for transcription. Defaults to replicate, or to aws with --speaker-labels.',
|
|
23
23
|
required: false,
|
|
24
24
|
exampleValue: defaultSpeechTranscribeProvider,
|
|
25
25
|
},
|
|
@@ -50,6 +50,23 @@ const speechTranscribeExecutionDefinition = {
|
|
|
50
50
|
required: false,
|
|
51
51
|
exampleValue: 'french',
|
|
52
52
|
},
|
|
53
|
+
{
|
|
54
|
+
name: 'speaker_labels',
|
|
55
|
+
kind: 'boolean',
|
|
56
|
+
propertyName: 'speakerLabels',
|
|
57
|
+
optionFlags: '--speaker-labels',
|
|
58
|
+
description: 'Label who is speaking: one paragraph per speaker in text, voice spans in WebVTT. Uses aws or gcp.',
|
|
59
|
+
required: false,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'max_speakers',
|
|
63
|
+
kind: 'number',
|
|
64
|
+
propertyName: 'maxSpeakers',
|
|
65
|
+
optionFlags: '--max-speakers',
|
|
66
|
+
description: 'Maximum number of speakers to label, from 1 to 10. Requires --speaker-labels.',
|
|
67
|
+
required: false,
|
|
68
|
+
exampleValue: 2,
|
|
69
|
+
},
|
|
53
70
|
],
|
|
54
71
|
};
|
|
55
72
|
const speechTranscribeCommandPresentation = {
|
|
@@ -67,14 +84,18 @@ const speechTranscribeCommandPresentation = {
|
|
|
67
84
|
'Generate subtitles',
|
|
68
85
|
'transloadit speech transcribe --input clip.mp4 --format webvtt --output captions.vtt',
|
|
69
86
|
],
|
|
87
|
+
[
|
|
88
|
+
'Label who is speaking in an interview',
|
|
89
|
+
'transloadit speech transcribe --input interview.mp4 --speaker-labels --output interview.txt',
|
|
90
|
+
],
|
|
70
91
|
],
|
|
71
92
|
};
|
|
72
93
|
function parseProvider(value) {
|
|
73
|
-
return
|
|
94
|
+
return parseOptionalEnumValue({
|
|
74
95
|
flagName: '--provider',
|
|
75
96
|
supportedValues: speechTranscribeProviders,
|
|
76
97
|
value,
|
|
77
|
-
})
|
|
98
|
+
});
|
|
78
99
|
}
|
|
79
100
|
function parseFormat(value) {
|
|
80
101
|
return (parseOptionalEnumValue({
|
|
@@ -93,19 +114,42 @@ function parseOptionalString(value, flagName) {
|
|
|
93
114
|
const trimmed = value.trim();
|
|
94
115
|
return trimmed.length > 0 ? trimmed : null;
|
|
95
116
|
}
|
|
117
|
+
function parseMaxSpeakers(value, speakerLabels) {
|
|
118
|
+
if (value == null) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
if (!speakerLabels) {
|
|
122
|
+
throw new Error('--max-speakers requires --speaker-labels');
|
|
123
|
+
}
|
|
124
|
+
if (typeof value !== 'number' || !Number.isInteger(value) || value < 1 || value > 10) {
|
|
125
|
+
throw new Error('--max-speakers must be an integer from 1 to 10');
|
|
126
|
+
}
|
|
127
|
+
return value;
|
|
128
|
+
}
|
|
96
129
|
function createSpeechTranscribeStep(rawValues, _context) {
|
|
97
|
-
const
|
|
130
|
+
const requestedProvider = parseProvider(rawValues.provider);
|
|
98
131
|
const format = parseFormat(rawValues.format);
|
|
99
132
|
const sourceLanguage = parseOptionalString(rawValues.source_language, '--source-language');
|
|
100
133
|
const targetLanguage = parseOptionalString(rawValues.target_language, '--target-language');
|
|
134
|
+
const speakerLabels = rawValues.speaker_labels === true;
|
|
135
|
+
const maxSpeakers = parseMaxSpeakers(rawValues.max_speakers, speakerLabels);
|
|
136
|
+
if (speakerLabels && requestedProvider === 'replicate') {
|
|
137
|
+
throw new Error('--speaker-labels needs --provider aws or gcp');
|
|
138
|
+
}
|
|
139
|
+
// Without an explicit provider, the API picks one that supports speaker labels.
|
|
140
|
+
const provider = speakerLabels
|
|
141
|
+
? requestedProvider
|
|
142
|
+
: (requestedProvider ?? defaultSpeechTranscribeProvider);
|
|
101
143
|
return {
|
|
102
144
|
robot: '/speech/transcribe',
|
|
103
145
|
use: ':original',
|
|
104
146
|
result: true,
|
|
105
|
-
provider,
|
|
147
|
+
...(provider != null ? { provider } : {}),
|
|
106
148
|
format,
|
|
107
149
|
...(sourceLanguage != null ? { source_language: sourceLanguage } : {}),
|
|
108
150
|
...(targetLanguage != null ? { target_language: targetLanguage } : {}),
|
|
151
|
+
...(speakerLabels ? { speaker_labels: true } : {}),
|
|
152
|
+
...(maxSpeakers != null ? { max_speakers: maxSpeakers } : {}),
|
|
109
153
|
};
|
|
110
154
|
}
|
|
111
155
|
export const speechTranscribeSemanticIntentDescriptor = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"speechTranscribe.js","sourceRoot":"","sources":["../../../src/cli/semanticIntents/speechTranscribe.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,uCAAuC,EAAE,MAAM,kDAAkD,CAAA;AAC1G,OAAO,EAAE,sBAAsB,EAAE,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AM,EAAE,IAAI;QACZ,GAAG,CAAC,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzC,MAAM;QACN,GAAG,CAAC,cAAc,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACtE,GAAG,CAAC,cAAc,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACtE,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAClD,GAAG,CAAC,WAAW,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9D,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,wCAAwC,GAAG;IACtD,UAAU,EAAE,0BAA0B;IACtC,iBAAiB,EAAE,YAAY;IAC/B,SAAS,EAAE,mCAAmC;IAC9C,WAAW,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;IACjC,iBAAiB,EAAE,gDAAgD;IACnE,YAAY,EAAE,mCAAmC;IACjD,UAAU,EAAE,WAAW;CACoB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transloadit/node",
|
|
3
|
-
"version": "6.
|
|
4
|
-
"description": "Node.js SDK for Transloadit",
|
|
3
|
+
"version": "6.7.0",
|
|
4
|
+
"description": "Node.js SDK and `transloadit` CLI for Transloadit",
|
|
5
5
|
"homepage": "https://github.com/transloadit/node-sdk/tree/main/packages/node",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/transloadit/node-sdk/issues"
|
|
@@ -33,7 +33,8 @@ const speechTranscribeExecutionDefinition = {
|
|
|
33
33
|
kind: 'string',
|
|
34
34
|
propertyName: 'provider',
|
|
35
35
|
optionFlags: '--provider',
|
|
36
|
-
description:
|
|
36
|
+
description:
|
|
37
|
+
'Provider to use for transcription. Defaults to replicate, or to aws with --speaker-labels.',
|
|
37
38
|
required: false,
|
|
38
39
|
exampleValue: defaultSpeechTranscribeProvider,
|
|
39
40
|
},
|
|
@@ -65,6 +66,24 @@ const speechTranscribeExecutionDefinition = {
|
|
|
65
66
|
required: false,
|
|
66
67
|
exampleValue: 'french',
|
|
67
68
|
},
|
|
69
|
+
{
|
|
70
|
+
name: 'speaker_labels',
|
|
71
|
+
kind: 'boolean',
|
|
72
|
+
propertyName: 'speakerLabels',
|
|
73
|
+
optionFlags: '--speaker-labels',
|
|
74
|
+
description:
|
|
75
|
+
'Label who is speaking: one paragraph per speaker in text, voice spans in WebVTT. Uses aws or gcp.',
|
|
76
|
+
required: false,
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'max_speakers',
|
|
80
|
+
kind: 'number',
|
|
81
|
+
propertyName: 'maxSpeakers',
|
|
82
|
+
optionFlags: '--max-speakers',
|
|
83
|
+
description: 'Maximum number of speakers to label, from 1 to 10. Requires --speaker-labels.',
|
|
84
|
+
required: false,
|
|
85
|
+
exampleValue: 2,
|
|
86
|
+
},
|
|
68
87
|
] as const satisfies readonly IntentOptionDefinition[],
|
|
69
88
|
} satisfies IntentDynamicStepExecutionDefinition
|
|
70
89
|
|
|
@@ -83,17 +102,19 @@ const speechTranscribeCommandPresentation = {
|
|
|
83
102
|
'Generate subtitles',
|
|
84
103
|
'transloadit speech transcribe --input clip.mp4 --format webvtt --output captions.vtt',
|
|
85
104
|
],
|
|
105
|
+
[
|
|
106
|
+
'Label who is speaking in an interview',
|
|
107
|
+
'transloadit speech transcribe --input interview.mp4 --speaker-labels --output interview.txt',
|
|
108
|
+
],
|
|
86
109
|
] as Array<[string, string]>,
|
|
87
110
|
} as const satisfies SemanticIntentPresentation
|
|
88
111
|
|
|
89
|
-
function parseProvider(value: unknown): SpeechTranscribeProvider {
|
|
90
|
-
return (
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}) ?? defaultSpeechTranscribeProvider
|
|
96
|
-
)
|
|
112
|
+
function parseProvider(value: unknown): SpeechTranscribeProvider | null {
|
|
113
|
+
return parseOptionalEnumValue({
|
|
114
|
+
flagName: '--provider',
|
|
115
|
+
supportedValues: speechTranscribeProviders,
|
|
116
|
+
value,
|
|
117
|
+
})
|
|
97
118
|
}
|
|
98
119
|
|
|
99
120
|
function parseFormat(value: unknown): SpeechTranscribeFormat {
|
|
@@ -119,23 +140,52 @@ function parseOptionalString(value: unknown, flagName: string): string | null {
|
|
|
119
140
|
return trimmed.length > 0 ? trimmed : null
|
|
120
141
|
}
|
|
121
142
|
|
|
143
|
+
function parseMaxSpeakers(value: unknown, speakerLabels: boolean): number | null {
|
|
144
|
+
if (value == null) {
|
|
145
|
+
return null
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (!speakerLabels) {
|
|
149
|
+
throw new Error('--max-speakers requires --speaker-labels')
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (typeof value !== 'number' || !Number.isInteger(value) || value < 1 || value > 10) {
|
|
153
|
+
throw new Error('--max-speakers must be an integer from 1 to 10')
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return value
|
|
157
|
+
}
|
|
158
|
+
|
|
122
159
|
function createSpeechTranscribeStep(
|
|
123
160
|
rawValues: Record<string, unknown>,
|
|
124
161
|
_context: { hasInputs: boolean },
|
|
125
162
|
): Record<string, unknown> {
|
|
126
|
-
const
|
|
163
|
+
const requestedProvider = parseProvider(rawValues.provider)
|
|
127
164
|
const format = parseFormat(rawValues.format)
|
|
128
165
|
const sourceLanguage = parseOptionalString(rawValues.source_language, '--source-language')
|
|
129
166
|
const targetLanguage = parseOptionalString(rawValues.target_language, '--target-language')
|
|
167
|
+
const speakerLabels = rawValues.speaker_labels === true
|
|
168
|
+
const maxSpeakers = parseMaxSpeakers(rawValues.max_speakers, speakerLabels)
|
|
169
|
+
|
|
170
|
+
if (speakerLabels && requestedProvider === 'replicate') {
|
|
171
|
+
throw new Error('--speaker-labels needs --provider aws or gcp')
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Without an explicit provider, the API picks one that supports speaker labels.
|
|
175
|
+
const provider = speakerLabels
|
|
176
|
+
? requestedProvider
|
|
177
|
+
: (requestedProvider ?? defaultSpeechTranscribeProvider)
|
|
130
178
|
|
|
131
179
|
return {
|
|
132
180
|
robot: '/speech/transcribe',
|
|
133
181
|
use: ':original',
|
|
134
182
|
result: true,
|
|
135
|
-
provider,
|
|
183
|
+
...(provider != null ? { provider } : {}),
|
|
136
184
|
format,
|
|
137
185
|
...(sourceLanguage != null ? { source_language: sourceLanguage } : {}),
|
|
138
186
|
...(targetLanguage != null ? { target_language: targetLanguage } : {}),
|
|
187
|
+
...(speakerLabels ? { speaker_labels: true } : {}),
|
|
188
|
+
...(maxSpeakers != null ? { max_speakers: maxSpeakers } : {}),
|
|
139
189
|
}
|
|
140
190
|
}
|
|
141
191
|
|