FranklinWillemen commited on
Commit
f54a48c
1 Parent(s): 1bd0bf3
Files changed (1) hide show
  1. discourse.py +5 -2
discourse.py CHANGED
@@ -7,6 +7,9 @@ AUDIO_FILE_NAME = "audio_response.wav"
7
 
8
  openai.api_key = os.environ['OPEN_AI_KEY']
9
 
 
 
 
10
  speech_config = speechsdk.SpeechConfig(subscription=os.environ['AZURE_SPEECH_KEY'], region="westeurope")
11
  speech_config.speech_synthesis_voice_name = "nl-NL-ColetteNeural"
12
  speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config, audio_config=None)
@@ -30,10 +33,10 @@ def gen_voice(response, response_filename):
30
  stream.save_to_wav_file(response_filename)
31
 
32
  def respond(audio:str):
33
- transcript = transcribe("whisper-1", audio)
34
  context.append({"role": "user", "content": transcript['text']})
35
 
36
- response = gen_response("gpt-3.5-turbo", context)
37
  context.append(response)
38
 
39
  gen_voice(response, AUDIO_FILE_NAME)
 
7
 
8
  openai.api_key = os.environ['OPEN_AI_KEY']
9
 
10
+ GEN_MODEL = "gpt-3.5-turbo"
11
+ TRANSCRIBE_MODEL = "whisper-1"
12
+
13
  speech_config = speechsdk.SpeechConfig(subscription=os.environ['AZURE_SPEECH_KEY'], region="westeurope")
14
  speech_config.speech_synthesis_voice_name = "nl-NL-ColetteNeural"
15
  speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config, audio_config=None)
 
33
  stream.save_to_wav_file(response_filename)
34
 
35
  def respond(audio:str):
36
+ transcript = transcribe(TRANSCRIBE_MODEL, audio)
37
  context.append({"role": "user", "content": transcript['text']})
38
 
39
+ response = gen_response(GEN_MODEL)
40
  context.append(response)
41
 
42
  gen_voice(response, AUDIO_FILE_NAME)