sasaki-saku commited on
Commit
a6df1a0
·
verified ·
1 Parent(s): efa2fce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -13
app.py CHANGED
@@ -10,8 +10,8 @@ def sort_key(key):
10
  return get_key_oai_info(_key)
11
  elif _key.startswith("AIzaSy"):
12
  return get_key_gemini_info(_key)
13
- elif len(_key.split(':')) == 2 and _key.split(':')[1].islower() and len(_key.split(':')[1]) == 32:
14
- endpoint = _key.split(':')[0]
15
  api_key = _key.split(':')[1]
16
  return get_key_azure_info(endpoint, api_key)
17
  elif "openai.azure.com" in _key.split(';')[0]:
@@ -25,7 +25,6 @@ def sort_key(key):
25
  else:
26
  return not_supported(_key)
27
 
28
-
29
  def get_key_oai_info(key):
30
  # Return a dictionary containing key information
31
  key_avai = check_key_availability(key)
@@ -91,18 +90,18 @@ def get_key_azure_info(endpoint, api_key):
91
  "gpt4_availability": "",
92
  "gpt4_turbo_availability": "",
93
  "gpt4_32k_availability": "",
94
- "moderation_response": "",
95
- "deployments": "",
96
- "models": ""}
97
  if key_avai[0]:
98
  azure_deploy = get_azure_deploy(endpoint, api_key)
99
  status = get_azure_status(endpoint, api_key, azure_deploy)
100
- info_dict["gpt35_availability"] = status[1],
101
- info_dict["gpt4_availability"] = status[2],
102
- info_dict["gpt4_turbo_availability"] = status[3],
103
- info_dict["gpt4_32k_availability"] = status[4],
104
- info_dict["moderation_response"] = status[0],
105
- info_dict["models"] = key_avai[1],
106
  info_dict["deployments"] = azure_deploy
107
  return info_dict
108
 
@@ -139,7 +138,10 @@ with gr.Blocks() as demo:
139
 
140
  *(Based on shaocongma, CncAnon1 and Drago key checkers)*
141
 
142
- (Azure endpoint's format: (https://)YOUR_RESOURCE_NAME.openai.azure.com;YOUR_API_KEY)
 
 
 
143
  ''')
144
 
145
  with gr.Row():
 
10
  return get_key_oai_info(_key)
11
  elif _key.startswith("AIzaSy"):
12
  return get_key_gemini_info(_key)
13
+ elif len(_key.split(':')) == 2 and _key.split(':')[1].islower() and len(_key.split(':')[1]) == 32 and "openai.azure.com" not in _key.split(':')[1]:
14
+ endpoint = f"{_key.split(':')[0]}.openai.azure.com"
15
  api_key = _key.split(':')[1]
16
  return get_key_azure_info(endpoint, api_key)
17
  elif "openai.azure.com" in _key.split(';')[0]:
 
25
  else:
26
  return not_supported(_key)
27
 
 
28
  def get_key_oai_info(key):
29
  # Return a dictionary containing key information
30
  key_avai = check_key_availability(key)
 
90
  "gpt4_availability": "",
91
  "gpt4_turbo_availability": "",
92
  "gpt4_32k_availability": "",
93
+ "moderation_status": "",
94
+ "models": "",
95
+ "deployments": ""}
96
  if key_avai[0]:
97
  azure_deploy = get_azure_deploy(endpoint, api_key)
98
  status = get_azure_status(endpoint, api_key, azure_deploy)
99
+ info_dict["gpt35_availability"] = status[1]
100
+ info_dict["gpt4_availability"] = status[2]
101
+ info_dict["gpt4_turbo_availability"] = status[3]
102
+ info_dict["gpt4_32k_availability"] = status[4]
103
+ info_dict["moderation_status"] = status[0]
104
+ info_dict["models"] = key_avai[1]
105
  info_dict["deployments"] = azure_deploy
106
  return info_dict
107
 
 
138
 
139
  *(Based on shaocongma, CncAnon1 and Drago key checkers)*
140
 
141
+ *Azure endpoint's format:*
142
+ *(https://)YOUR_RESOURCE_NAME.openai.azure.com;YOUR_API_KEY*
143
+ *YOUR_RESOURCE_NAME:YOUR_API_KEY*
144
+
145
  ''')
146
 
147
  with gr.Row():