Skip to content

Commit

Permalink
Prevent double loading
Browse files Browse the repository at this point in the history
Prevent double loading of model twice with making captions.
  • Loading branch information
cyberofficial committed Mar 10, 2024
1 parent 206efe1 commit a835851
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<History>True|2024-03-10T09:44:36.1805746Z;True|2024-03-10T03:38:51.0799496-04:00;True|2024-03-10T03:35:29.4272612-04:00;True|2024-03-10T03:33:55.4500733-04:00;True|2024-03-10T03:30:29.1421204-04:00;True|2024-03-10T03:11:38.6158306-04:00;True|2024-03-07T12:41:02.6855600-05:00;False|2024-03-07T12:40:01.3776107-05:00;</History>
<History>True|2024-03-10T10:33:16.3854689Z;True|2024-03-10T05:44:36.1805746-04:00;True|2024-03-10T03:38:51.0799496-04:00;True|2024-03-10T03:35:29.4272612-04:00;True|2024-03-10T03:33:55.4500733-04:00;True|2024-03-10T03:30:29.1421204-04:00;True|2024-03-10T03:11:38.6158306-04:00;True|2024-03-07T12:41:02.6855600-05:00;False|2024-03-07T12:40:01.3776107-05:00;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>
7 changes: 4 additions & 3 deletions transcribe_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,10 @@ def mic_calibration():
print(f"Loading model {model}...")

# remove .en from model if target_language is not set to English
if args.target_language != "en" or args.target_language != "English":
model = model.replace(".en", "")
audio_model = whisper.load_model(model, device=device, download_root="models")
if not args.makecaptions:
if args.target_language != "en" or args.target_language != "English":
model = model.replace(".en", "")
audio_model = whisper.load_model(model, device=device, download_root="models")

if args.microphone_enabled:
record_timeout = args.record_timeout
Expand Down

0 comments on commit a835851

Please sign in to comment.