Skip to content

Commit

Permalink
Feat translate option
Browse files Browse the repository at this point in the history
  • Loading branch information
Eidenz committed Feb 8, 2023
1 parent dce3669 commit bfc2177
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"compression_ratio_threshold": 2.4,
"condition_on_previous_text": True,
"verbose": False,
"task": False
}
WHISPER_SETTINGS_FILE = DATA_DIR / ".whisper_settings.json"

Expand Down
5 changes: 5 additions & 0 deletions app/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ def _transcribe(self, audio_path: str, whisper_model: str, **whisper_args):
else:
whisper_args["temperature"] = [whisper_args["temperature"]]

if whisper_args["task"]:
whisper_args["task"] = "translate"
else:
whisper_args["task"] = "transcribe"

del whisper_args["temperature_increment_on_fallback"]

transcript = transcriber.transcribe(
Expand Down

0 comments on commit bfc2177

Please sign in to comment.