Skip to content

Commit

Permalink
fix: simplify A2T return_timestamps type (#239)
Browse files Browse the repository at this point in the history
In the previous pull request, I adhered to the union type used by Whisper, but
this caused issues in the multipart handling. To avoid complicating the MultiPartWriter,
this commit converts the union type to a string. This change simplifies the multipart
handling and user confusion.
  • Loading branch information
rickstaa authored Oct 25, 2024
1 parent 49b460f commit 66226cf
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 149 deletions.
7 changes: 4 additions & 3 deletions runner/app/routes/audio_to_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,13 @@ async def audio_to_text(
] = "",
pipeline: Pipeline = Depends(get_pipeline),
return_timestamps: Annotated[
Union[str, bool],
str,
Form(
description=(
"Return timestamps for the transcribed text. Supported values: "
"'sentence', 'word', or a boolean. Default is True ('sentence'). "
"False means no timestamps. 'word' means word-based timestamps."
"'sentence', 'word', or a string boolean ('true' or 'false'). Default "
"is 'true' ('sentence'). 'false' means no timestamps. 'word' means "
"word-based timestamps."
)
),
] = "true",
Expand Down
9 changes: 4 additions & 5 deletions runner/gateway.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -437,13 +437,12 @@ components:
description: Hugging Face model ID used for transcription.
default: ''
return_timestamps:
anyOf:
- type: string
- type: boolean
type: string
title: Return Timestamps
description: 'Return timestamps for the transcribed text. Supported values:
''sentence'', ''word'', or a boolean. Default is True (''sentence'').
False means no timestamps. ''word'' means word-based timestamps.'
''sentence'', ''word'', or a string boolean (''true'' or ''false''). Default
is ''true'' (''sentence''). ''false'' means no timestamps. ''word'' means
word-based timestamps.'
default: 'true'
type: object
required:
Expand Down
9 changes: 4 additions & 5 deletions runner/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -448,13 +448,12 @@ components:
description: Hugging Face model ID used for transcription.
default: ''
return_timestamps:
anyOf:
- type: string
- type: boolean
type: string
title: Return Timestamps
description: 'Return timestamps for the transcribed text. Supported values:
''sentence'', ''word'', or a boolean. Default is True (''sentence'').
False means no timestamps. ''word'' means word-based timestamps.'
''sentence'', ''word'', or a string boolean (''true'' or ''false''). Default
is ''true'' (''sentence''). ''false'' means no timestamps. ''word'' means
word-based timestamps.'
default: 'true'
type: object
required:
Expand Down
199 changes: 63 additions & 136 deletions worker/runner.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 66226cf

Please sign in to comment.