Skip to content

Add option to SRT translate output - Fix inside #15

@GodlikeRU

Description

@GodlikeRU

Translation works only for plain text for now. It's useless if you would like to translate YouTube video to upload subtitles for English for example. This modified code will make sure translation output is also formatted to SRT.

Start on line 137, predict.py:

if translate:
translationResult = model.transcribe(
str(audio), task="translate", temperature=temperature, **args
)
# MODIFIED to translate to SRT
translation = write_srt(translationResult["segments"])
return ModelOutput(
segments=result["segments"],
detected_language=LANGUAGES[result["language"]],
transcription=transcription,
translation=translation if translate else None,
)

I tested it on another model, works great.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions