simpx commited on
Commit
8ef5719
·
1 Parent(s): cd2cb77
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -3,7 +3,10 @@ import openai
3
 
4
  # The first line contains the OpenAI key, while the second line provides the OpenAI URL, which is useful when the OpenAI server is hidden behind a proxy server.
5
  # eg. first line "sk-xxxxxxxxxx", second line "http://PROXY-URL"
6
- config = open("config").readlines()
 
 
 
7
  api_key_from_config = ""
8
  if len(config) > 0 and len(config[0].strip()) > 0:
9
  api_key_from_config = config[0].strip()
 
3
 
4
  # The first line contains the OpenAI key, while the second line provides the OpenAI URL, which is useful when the OpenAI server is hidden behind a proxy server.
5
  # eg. first line "sk-xxxxxxxxxx", second line "http://PROXY-URL"
6
+ if os.path.isfile('config'):
7
+ config = open("config").readlines()
8
+ else:
9
+ config = ""
10
  api_key_from_config = ""
11
  if len(config) > 0 and len(config[0].strip()) > 0:
12
  api_key_from_config = config[0].strip()