Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support translation of input audio to english #100

Merged
merged 6 commits into from
Sep 3, 2024
Merged

Conversation

philmcmahon
Copy link
Contributor

What does this change?

The library we are using for transcription - whisper.cpp - supports translation to english.

This PR modifies the transcription tool to make use of this feature. A new checkbox is added to the submission form:

Screenshot 2024-08-30 at 14 00 12

This value is sent through to the API. If true, then the API will send 2 messages rather than 1 to the queue. The extra message will have the same id but with -translation appended.

The worker then proceeds as normal, but when it finishes and uploads the output text, if it's a translation then -translation is appended to each of the json/srt/txt filenames.

The output handler modifies the email subject and message if it's a translation to indicate this:
Screenshot 2024-08-30 at 14 03 11

The end result is that the user receives 2 emails. Whilst it would be nicer to have just one email with links to both docs, this approach means that they get the transcript as soon as possible, and we don't have to deal with any kind of state management of waiting for one or the other outputs.

How to test

Tested on CODE

@philmcmahon philmcmahon requested a review from a team as a code owner August 30, 2024 13:04
@philmcmahon philmcmahon changed the title Support translation Support translation of input audio to english Aug 30, 2024
@hoyla
Copy link
Contributor

hoyla commented Aug 30, 2024

Exciting!

@@ -74,11 +80,12 @@ const handleTranscriptionSuccess = async (
sesClient,
config.app.emailNotificationFromAddress,
transcriptionOutput.userEmail,
`Transcription complete for ${transcriptionOutput.originalFilename}`,
`Transcription ${transcriptionOutput.isTranslation ? 'english translation ' : ''}complete for ${transcriptionOutput.originalFilename}`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you think about this?

Suggested change
`Transcription ${transcriptionOutput.isTranslation ? 'english translation ' : ''}complete for ${transcriptionOutput.originalFilename}`,
`${transcriptionOutput.isTranslation ? 'English translation' : 'Transcription'} complete for ${transcriptionOutput.originalFilename}`,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's a translation email we don't want subject to be "Transcription english translation complete..." right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and same for failure subject and message body?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm I was thinking that it's technically a translation of the transcription, but "transcription english translation is a bit of a mouthfull! I think your suggestion is clearer - it's kinda implicit that it's a transcription

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated in 4767813

@hoyla
Copy link
Contributor

hoyla commented Aug 30, 2024

When you get the email saying the transcription (and translation?) is complete, and "Click here to export to a google doc", would it open both docs? Am wondering how people might get to each of the two documents...

[ADD: ah, you get two emails. Sorry]

@philmcmahon
Copy link
Contributor Author

Yep there are 2 emails which will result in 2 google docs if they export them both
Screenshot 2024-08-30 at 16 27 12

Copy link
Contributor

@marjisound marjisound left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great use of 10%, nice work

@philmcmahon philmcmahon merged commit e37afee into main Sep 3, 2024
3 checks passed
@philmcmahon philmcmahon deleted the support-translation branch September 3, 2024 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants