Xubo-Liu commited on
Commit
4b5b11a
1 Parent(s): 2378d34

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +8 -4
utils.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import re
2
  import torch
3
  import numpy as np
@@ -59,8 +60,11 @@ def fade(audio_data, fade_duration=2, sr=32000):
59
  audio_data_faded = np.concatenate((audio_data_fade_in, audio_data[len(fade_in):-len(fade_out)], audio_data_fade_out))
60
  return audio_data_faded
61
 
62
- def get_key(config='config.yaml'):
63
- with open('config.yaml', 'r') as file:
64
- config = yaml.safe_load(file)
65
- return config['OpenAI-Key'] if 'OpenAI-Key' in config else None
66
 
 
 
 
 
1
+ import os
2
  import re
3
  import torch
4
  import numpy as np
 
60
  audio_data_faded = np.concatenate((audio_data_fade_in, audio_data[len(fade_in):-len(fade_out)], audio_data_fade_out))
61
  return audio_data_faded
62
 
63
+ # def get_key(config='config.yaml'):
64
+ # with open('config.yaml', 'r') as file:
65
+ # config = yaml.safe_load(file)
66
+ # return config['OpenAI-Key'] if 'OpenAI-Key' in config else None
67
 
68
+ def get_api_key():
69
+ api_key = os.environ.get('OPENAI_KEY')
70
+ return api_key