Commit
·
049253f
1
Parent(s):
b5eb49a
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import openai
|
| 3 |
import anthropic
|
| 4 |
from api_usage import get_subscription, check_key_availability, check_key_ant_availability
|
| 5 |
|
|
@@ -12,23 +11,29 @@ def sort_key(key):
|
|
| 12 |
|
| 13 |
def get_key_oai_info(key):
|
| 14 |
# Return a dictionary containing key information
|
| 15 |
-
|
| 16 |
-
key_avai = check_key_availability()
|
| 17 |
info_dict = {"account_name": "",
|
| 18 |
"key_availability": True if key_avai else False,
|
| 19 |
"gpt4_availability": "",
|
| 20 |
"gpt4_32k_availability": "",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
"requests_per_minute": "",
|
| 22 |
"tokens_per_minute": "",
|
| 23 |
-
"
|
| 24 |
"quota": ""}
|
| 25 |
if key_avai:
|
| 26 |
-
info = get_subscription(key
|
| 27 |
info_dict["gpt4_availability"] = info["has_gpt4"]
|
| 28 |
info_dict["gpt4_32k_availability"] = info["has_gpt4_32k"]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
info_dict["requests_per_minute"] = info["rpm"]
|
| 30 |
info_dict["tokens_per_minute"] = info["tpm"]
|
| 31 |
-
info_dict["organization"] = info["organization"]
|
| 32 |
info_dict["quota"] = info["quota"]
|
| 33 |
return info_dict
|
| 34 |
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
import anthropic
|
| 3 |
from api_usage import get_subscription, check_key_availability, check_key_ant_availability
|
| 4 |
|
|
|
|
| 11 |
|
| 12 |
def get_key_oai_info(key):
|
| 13 |
# Return a dictionary containing key information
|
| 14 |
+
key_avai = check_key_availability(key)
|
|
|
|
| 15 |
info_dict = {"account_name": "",
|
| 16 |
"key_availability": True if key_avai else False,
|
| 17 |
"gpt4_availability": "",
|
| 18 |
"gpt4_32k_availability": "",
|
| 19 |
+
"default_org": "",
|
| 20 |
+
"org_description": "",
|
| 21 |
+
"organization": "",
|
| 22 |
+
"models": "",
|
| 23 |
"requests_per_minute": "",
|
| 24 |
"tokens_per_minute": "",
|
| 25 |
+
#"tokens_per_minute_left": "",
|
| 26 |
"quota": ""}
|
| 27 |
if key_avai:
|
| 28 |
+
info = get_subscription(key)
|
| 29 |
info_dict["gpt4_availability"] = info["has_gpt4"]
|
| 30 |
info_dict["gpt4_32k_availability"] = info["has_gpt4_32k"]
|
| 31 |
+
info_dict["default_org"] = info["default_org"]
|
| 32 |
+
info_dict["org_description"] = info["org_description"]
|
| 33 |
+
info_dict["organization"] = info["organization"]
|
| 34 |
+
info_dict["models"] = info["models"]
|
| 35 |
info_dict["requests_per_minute"] = info["rpm"]
|
| 36 |
info_dict["tokens_per_minute"] = info["tpm"]
|
|
|
|
| 37 |
info_dict["quota"] = info["quota"]
|
| 38 |
return info_dict
|
| 39 |
|