Skip to content

Commit

Permalink
--api option was not working correctly even when a good API key was p…
Browse files Browse the repository at this point in the history
…rovided.
  • Loading branch information
vivekuppal committed Jul 21, 2023
1 parent 4be26c7 commit fe764e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions TranscriberModels.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import whisper
import os
import torch
import GlobalVars


def get_model(use_api: bool, model: str = None):
Expand Down Expand Up @@ -61,6 +62,7 @@ def load_model(self):
class APIWhisperTranscriber:
def __init__(self):
print('Using Open AI API for transcription.')
openai.api_key = GlobalVars.TranscriptionGlobals().api_key
# lang parameter is not required for API invocation. This exists solely
# to support --api option from command line.
# A better solution is to create a base class for APIWhisperTranscriber,
Expand Down
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ def main():
except ConnectionError:
print('Operating as a standalone client')

global_vars = GlobalVars.TranscriptionGlobals()
config = configuration.Config().get_data()
global_vars = GlobalVars.TranscriptionGlobals(key=config["OpenAI"]["api_key"])

# Command line arg for api_key takes preference over api_key specified in parameters.yaml file
if args.api_key is not None:
Expand Down Expand Up @@ -120,7 +120,7 @@ def main():

ui_cb = ui.ui_callbacks()
global_vars.freeze_button.configure(command=ui_cb.freeze_unfreeze)
update_interval_slider_label.configure(text=f"Update interval: \
update_interval_slider_label.configure(text=f"Update Response interval: \
{update_interval_slider.get()} \
seconds")

Expand Down

0 comments on commit fe764e2

Please sign in to comment.